master
fanfan 5 months ago
parent 4e486a8af1
commit 0834c1ccc7
  1. 10
      src/components/Modal/GoodsModal/GoodsModal.vue
  2. 12
      src/views/goods/Index.vue
  3. 34
      src/views/goods/modules/MultiSpec.vue

@ -52,6 +52,11 @@
/>
</template>
<!-- 商品状态 -->
<span slot="spec_type" slot-scope="text">
<p class="twoline-hide" style="width: 40px">
{{ text == 10 ? '单规格' : '多规格' }}
</p>
</span>
<span slot="status" slot-scope="text">
<a-tag :color="text == 10 ? 'green' : 'red'">{{ text == 10 ? '上架' : '下架' }}</a-tag>
</span>
@ -76,6 +81,11 @@ const columns = [
title: '商品信息',
width: '335px',
scopedSlots: { customRender: 'item' },
},
{
title: '规格类型',
dataIndex: 'spec_type',
scopedSlots: { customRender: 'spec_type' },
},
{
title: '商品价格',

@ -156,6 +156,11 @@
<span slot="status" slot-scope="text, item">
<a-tag class="cur-p" :color="text == 10 ? 'green' : 'red'" @click="handleUpdateStatus([item.goods_id], text != 10)">{{ text == 10 ? '上架' : '下架' }}</a-tag>
</span>
<span slot="spec_type" slot-scope="text">
<p class="twoline-hide" style="width: 40px">
{{ text == 10 ? '单规格' : '多规格' }}
</p>
</span>
<span slot="cate_status" slot-scope="text">
<p class="twoline-hide" style="width: 40px" :style="{ color: text == 0 ? 'red' : 'green' }">
{{ text == 0 ? '待处理' : '已归类' }}
@ -225,6 +230,13 @@ const columns = [
dataIndex: 'goods_name',
width: '260px',
scopedSlots: { customRender: 'goods_name' },
},
{
title: '规格类型',
width: '90px',
dataIndex: 'spec_type',
scopedSlots: { customRender: 'spec_type' },
sorter: true,
},
{
title: '商品价格',

@ -120,10 +120,12 @@
{{ item.goods_sku_no }}
</template>
<!-- 操作 -->
<template slot="action" slot-scope="text, item">
<router-link v-if="item.goods_id" :to="{ path: '/goods/update', query: { goodsId: item.goods_id } }"
<template slot="action" slot-scope="text, item, index">
<!-- <router-link v-if="item.goods_id" :to="{ path: '/goods/update', query: { goodsId: item.goods_id } }"
>去修改</router-link
>
> -->
<a @click="handleEdit(index, item)" v-if="item.goods_id" style="margin-left: 10px">去修改</a>
<a @click="handleCancel(index, item)" v-if="item.goods_id" style="margin-left: 10px">取消选择</a>
</template>
</a-table>
</a-form-item>
@ -150,7 +152,7 @@ export default {
// ()
isSpecLocked: PropTypes.bool.def(false),
checkList: PropTypes.array.def([]),
source: PropTypes.any.def(0)
source: PropTypes.any.def(0),
},
data() {
return {
@ -183,6 +185,25 @@ export default {
this.getData()
},
methods: {
handleEdit(item) {
const routeData = this.$router.resolve({
path: '/goods/update',
query: {
goodsId: item.goods_id,
},
})
window.open(routeData.href, '_blank')
},
handleCancel(index, item) {
for (let key in this.multiSpecData.skuList[index]) {
if (this.multiSpecData.skuList[index].hasOwnProperty(key)) {
this.multiSpecData.skuList[index][key] = ''
}
}
this.multiSpecData.skuList[index].spec_value_0 = item.spec_value_0
this.multiSpecData.skuList[index].tempId = item.tempId
this.multiSpecData.skuList[index].skuKeys = item.skuKeys
},
// SKU()
getData() {
const { defaultSpecList, defaultSkuList } = this
@ -282,14 +303,13 @@ export default {
const skuItem = skuList.find((sku) => sku.goods_id === goodsId)
if (skuItem) {
this.$message.error('一个商品只能选择一次', 2)
return false
return
}
this.getGoodsDetail(goodsId).then((res) => {
const queryGoodsId = this.$route.query.goodsId
if (res.spec_type === 20 && queryGoodsId !== goodsId) {
this.$message.error('您选择的商品是多规格商品', 2)
return false
return
}
const sku = res.skuList[0]

Loading…
Cancel
Save