Commit f028c386 by 王志慧

fixed

1 parent d73e9f64
<template>
<!-- <div>商品详情</div> -->
<GLDialog destroy-on-close="true" :visible.sync="dialogShow" :hasFooter="false" mode="big" bigTitle="产品详情"
:close-on-click-modal="false" @onOk="handleSubmit" @onCancel="handleDetailClose">
<GLDialog destroy-on-close="true" :visible.sync="dialogShow" :hasFooter="false" mode="big" bigTitle="产品详情" :close-on-click-modal="false" @onOk="handleSubmit" @onCancel="handleDetailClose">
<div class="detail-content">
<!-- 商品详情 -->
<div class="goodsInfoCom">
......@@ -20,15 +19,20 @@
<span class="num">{{ goodsInfo.purchaseOrderCount || 0 }}笔</span>
</span>
</div>
<div class="productCode" v-if="goodsInfo.upgradeGoodsList&&goodsInfo.upgradeGoodsList.length>0">商品编码:{{goodsInfo.upgradeGoodsList[selectIndex].type}}</div>
<div class="productCode" v-if="goodsInfo.upgradeGoodsList && goodsInfo.upgradeGoodsList.length > 0">商品编码:{{ goodsInfo.upgradeGoodsList[selectIndex].type }}</div>
<div class="skuCon">
<div class="label">规格:</div>
<div class="itemCon">
<div class="skuItem one-line-ellipsis pointer" :class="{ active: index === selectIndex }"
v-for="(item, index) in goodsInfo.upgradeGoodsList" :key="index" @click="
<div
class="skuItem one-line-ellipsis pointer"
:class="{ active: index === selectIndex }"
v-for="(item, index) in goodsInfo.upgradeGoodsList"
:key="index"
@click="
selectIndex = index
setHandleItemInfo(item)
">
setHandleItemInfo(item)
"
>
{{ item.upgradeGoodsName }}
</div>
</div>
......@@ -47,7 +51,7 @@
</div>
<!-- <i class="carIcon"></i> -->
</div>
<div class="table-wrap" v-if="tableInfo&&tableInfo.length">
<div class="table-wrap" v-if="tableInfo && tableInfo.length">
<h3>适用门店</h3>
<GLTable :hasNum="false" :hasPage="false" :tableParams="tableParams" :table-data="tableInfo"></GLTable>
</div>
......@@ -76,7 +80,7 @@ export default {
},
selectItemInfo: {
type: Object,
default: () => { }
default: () => {}
},
goodsId: {
type: [String, Number]
......@@ -156,20 +160,17 @@ export default {
// this.goodsInfo.upgradeGoodsList[index] = this.goodsInfo.upgradeGoodsList[0]
// }
// 默认选中第一个
const item = this.goodsInfo.upgradeGoodsList[0]
// console.log(item)
item && this.setHandleItemInfo(item)
let item = this.goodsInfo.upgradeGoodsList[0]
this.setHandleItemInfo(item)
})
},
setHandleItemInfo(item) {
console.log(item)
setHandleItemInfo(item = {}) {
const { id, purchasePrice } = item
this.handleItemInfo = Object.assign(this.handleItemInfo, {
upgradeGoodsId: id,
purchasePrice
})
// this.tableInfo = item.merchantGoodsInfo
this.tableInfo = item.merchantGoodsInfo.filter(item => item.goodsAlias)
this.tableInfo = item.merchantGoodsInfo && item.merchantGoodsInfo.filter(item => item.goodsAlias)
},
handleDetailClose() {
this.dialogShow = false
......@@ -179,10 +180,13 @@ export default {
goodsNumber: this.handleItemInfo.goodsNumber,
upgradeGoodsId: this.handleItemInfo.upgradeGoodsId
}
if (!params.upgradeGoodsId) {
this.$message.error('商品不存在')
return
}
// 判断是否有值
params.upgradeGoodsId &&
this.$apis.purchaseShopping.shoppingCarAdd(params).then(res => {
// console.log(res)
this.$message.success('加入购物车成功')
this.$EventBus.$emit('updateCarShopping')
this.dialogShow = false
......@@ -329,11 +333,11 @@ export default {
margin-bottom: 16px;
}
}
.productCode{
.productCode {
font-weight: 400;
font-size: 14px;
color: #666666;
margin-bottom:16px;
padding-left: 18px;
font-size: 14px;
color: #666666;
margin-bottom: 16px;
padding-left: 18px;
}
</style>
......@@ -228,7 +228,6 @@ export default {
})
},
handleAllCheckChange(value) {
console.log(value)
const idsName = value ? 'selectedIds' : 'notSelectedIds'
const list = this.goodsSelectStatus.map(item => {
// item.selectedFlag = value ? 'Y' : 'N'
......@@ -237,7 +236,6 @@ export default {
this.updateSelectedFlag({ [idsName]: list })
},
handleGoodsTypeCheckChange(value, typeList) {
console.log(value)
const idsName = value ? 'selectedIds' : 'notSelectedIds'
const list = typeList.upgradeGoodsList.map(item => {
return item.id
......@@ -245,7 +243,6 @@ export default {
this.updateSelectedFlag({ [idsName]: list })
},
handleGoodsCheckChange(value, goodsItem) {
console.log(value)
const idsName = value ? 'selectedIds' : 'notSelectedIds'
// this.restGoodsList()
this.updateSelectedFlag({
......@@ -297,7 +294,6 @@ export default {
let goodsSelectTotalNumber = 0
let goodsTotalNumber = 0
let isIndeterminate = false
console.log('this.goodsList', this.goodsList)
// debugger
this.goodsList = this.goodsList.map(item => {
const length = item.upgradeGoodsList.length
......@@ -305,7 +301,6 @@ export default {
item.goodsTypeCheckout = item.upgradeGoodsList.every(goodsItem => goodsItem.selectedFlag)
item.upgradeGoodsList.forEach(goodsItem => {
// if (goodsItem.selectedFlag == 'Y') isIndeterminate = true
console.log(goodsItem, 'goodsItem')
goodsTotalNumber += 1
if (goodsItem.selectedFlag) {
// debugger
......@@ -325,7 +320,7 @@ export default {
return item
})
// 只有有一个选中并且不是全选状态
console.log(isIndeterminate)
this.isIndeterminate = checkoutFlag ? false : isIndeterminate
this.goodsSelectTotalNumber = goodsSelectTotalNumber
this.goodsTotalNumber = goodsTotalNumber
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!