|
@@ -1,13 +1,14 @@
|
|
<template>
|
|
<template>
|
|
<div class="app-container goods-add">
|
|
<div class="app-container goods-add">
|
|
<el-divider content-position="left">商品信息</el-divider>
|
|
<el-divider content-position="left">商品信息</el-divider>
|
|
- <el-form ref="addItem" :rules="rules" :model="addData" label-width="120px">
|
|
|
|
|
|
+ <el-form ref="addItem" :rules="rules" :model="addData" label-width="130px">
|
|
<el-row :gutter="40" style="width: 500px">
|
|
<el-row :gutter="40" style="width: 500px">
|
|
<el-col :span="23">
|
|
<el-col :span="23">
|
|
<el-form-item label="商品类型:" prop="type">
|
|
<el-form-item label="商品类型:" prop="type">
|
|
- <el-radio-group v-model="addData.type" :disabled="addData.goodsId ? true : false">
|
|
|
|
|
|
+ <el-radio-group v-model="addData.type" :disabled="addData.goodsId ? true : false" @input="typeChange">
|
|
<el-radio :label="1">实物商品</el-radio>
|
|
<el-radio :label="1">实物商品</el-radio>
|
|
<el-radio :label="2">卡密商品</el-radio>
|
|
<el-radio :label="2">卡密商品</el-radio>
|
|
|
|
+ <el-radio :label="3">采购商品</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
@@ -36,8 +37,8 @@
|
|
<!-- <div class="tip">关闭则不再兑换大厅显示,不支持盲豆兑换。</div>-->
|
|
<!-- <div class="tip">关闭则不再兑换大厅显示,不支持盲豆兑换。</div>-->
|
|
<el-radio-group v-model="addData.exchangeShow">
|
|
<el-radio-group v-model="addData.exchangeShow">
|
|
<el-radio :label="0">不支持</el-radio>
|
|
<el-radio :label="0">不支持</el-radio>
|
|
- <el-radio :label="1">支持</el-radio>
|
|
|
|
- <el-radio :label="2">盲票商品</el-radio>
|
|
|
|
|
|
+ <el-radio :label="1" :disabled="addData.type == '3'">支持</el-radio>
|
|
|
|
+ <el-radio :label="2" :disabled="addData.type == '3'">盲票商品</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
@@ -68,6 +69,27 @@
|
|
|
|
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
|
|
+ <el-row :gutter="40" style="width: 600px" v-if="addData.type == '3'">
|
|
|
|
+ <el-col :span="23">
|
|
|
|
+ <el-form-item label="关联采购优惠券:" prop="refId">
|
|
|
|
+ <el-select
|
|
|
|
+ v-model="addData.refId" :disabled="addData.goodsId ? true : false"
|
|
|
|
+ placeholder="请选择采购优惠券"
|
|
|
|
+ filterable
|
|
|
|
+ clearable>
|
|
|
|
+ <el-option :label="item.title" :value="item.couponId" v-for="(item, index) in CouponList" :key="index">
|
|
|
|
+ <div>
|
|
|
|
+ <span style="float: left; width: 130px; overflow: hidden; text-overflow: ellipsis;">{{ item.title }} </span>
|
|
|
|
+ <span style="float: left; width: 110px; overflow: hidden; text-overflow: ellipsis;">¥{{ $numberFormat(item.discount) }}</span>
|
|
|
|
+ <span style="float: right;">{{ item.channelSharedRate }}%</span>
|
|
|
|
+ </div>
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ <div class="tip">根据优惠券名称查询(优惠券名称--价格--门店承担比例)</div>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+
|
|
<el-row :gutter="40" style="width: 500px">
|
|
<el-row :gutter="40" style="width: 500px">
|
|
<el-col :span="23">
|
|
<el-col :span="23">
|
|
<el-form-item label="商品采购链接:">
|
|
<el-form-item label="商品采购链接:">
|
|
@@ -100,7 +122,7 @@
|
|
<el-divider content-position="left">价格库存</el-divider>
|
|
<el-divider content-position="left">价格库存</el-divider>
|
|
<el-row>
|
|
<el-row>
|
|
<el-col :span="23">
|
|
<el-col :span="23">
|
|
- <el-form-item label="启用多SKU:" v-if="addData.type == '1'">
|
|
|
|
|
|
+ <el-form-item label="启用多SKU:" v-if="addData.type == '1' || addData.type == '3'">
|
|
<el-switch
|
|
<el-switch
|
|
v-model="addData.multiSku"
|
|
v-model="addData.multiSku"
|
|
:active-value="1"
|
|
:active-value="1"
|
|
@@ -110,11 +132,16 @@
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
<el-row>
|
|
<el-row>
|
|
- <el-col :span="22">
|
|
|
|
|
|
+ <el-col :span="22" v-if="addData.type != 3">
|
|
<el-form-item prop="skuList">
|
|
<el-form-item prop="skuList">
|
|
<Spec ref="spec" @valid="update" :multiSku="addData.multiSku"/>
|
|
<Spec ref="spec" @valid="update" :multiSku="addData.multiSku"/>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
|
|
+ <el-col :span="22" v-else>
|
|
|
|
+ <el-form-item prop="skuList">
|
|
|
|
+ <SpeTwo ref="spec" @valid="update" :multiSku="addData.multiSku"/>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
</el-row>
|
|
</el-row>
|
|
|
|
|
|
<el-row v-if="addData.multiSku === 0" :gutter="40" style="width: 600px">
|
|
<el-row v-if="addData.multiSku === 0" :gutter="40" style="width: 600px">
|
|
@@ -125,6 +152,22 @@
|
|
</el-input>
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
|
|
+ <el-col :span="23">
|
|
|
|
+ <el-form-item label="采购成本:" prop="purchaseCost" v-if="addData.type == '3'">
|
|
|
|
+ <el-input v-model="addData.purchaseCost" type="number" placeholder="请输入采购成本">
|
|
|
|
+ <template slot="append">元</template>
|
|
|
|
+ </el-input>
|
|
|
|
+ <div class="tip">注:指展示给经销商采购的成本,即商品的结算价格</div>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
|
|
+ <el-col :span="23">
|
|
|
|
+ <el-form-item label="零售价:" prop="purchasePrice" v-if="addData.type == '3'">
|
|
|
|
+ <el-input v-model="addData.purchasePrice" type="number" placeholder="请输入零售价">
|
|
|
|
+ <template slot="append">元</template>
|
|
|
|
+ </el-input>
|
|
|
|
+ <div class="tip">注:指商品铺设给经销商的价格,仅作记录</div>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-col>
|
|
<el-col :span="23">
|
|
<el-col :span="23">
|
|
<el-form-item label="盲豆兑换数量:" prop="exchangePrice">
|
|
<el-form-item label="盲豆兑换数量:" prop="exchangePrice">
|
|
<el-input v-model="addData.exchangePrice" type="number" placeholder="请输入盲豆数量">
|
|
<el-input v-model="addData.exchangePrice" type="number" placeholder="请输入盲豆数量">
|
|
@@ -160,7 +203,7 @@
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="23">
|
|
<el-col :span="23">
|
|
- <el-form-item label="库存:" prop="quantity" v-if="addData.type == '1'">
|
|
|
|
|
|
+ <el-form-item label="库存:" prop="quantity" v-if="addData.type == '1' || addData.type == '3'">
|
|
<el-input v-model="addData.quantity" type="number" placeholder="请输入商品库存">
|
|
<el-input v-model="addData.quantity" type="number" placeholder="请输入商品库存">
|
|
<template slot="append">件</template>
|
|
<template slot="append">件</template>
|
|
</el-input>
|
|
</el-input>
|
|
@@ -199,8 +242,10 @@
|
|
import Upload from '@/components/DragImageUpload'
|
|
import Upload from '@/components/DragImageUpload'
|
|
import WangEditor from '@/components/WangEditor'
|
|
import WangEditor from '@/components/WangEditor'
|
|
import Spec from './components/spec'
|
|
import Spec from './components/spec'
|
|
|
|
+import SpeTwo from './components/spec2'
|
|
import TinyEditor from '@/components/TinyEditor'
|
|
import TinyEditor from '@/components/TinyEditor'
|
|
import {getGoodsDetail, addGoods} from '@/api/business/goods'
|
|
import {getGoodsDetail, addGoods} from '@/api/business/goods'
|
|
|
|
+import {getCouponAllList} from '@/api/business/coupon'
|
|
import {goodsCategoryListTree} from '@/api/business/category'
|
|
import {goodsCategoryListTree} from '@/api/business/category'
|
|
import {getSupplierList} from '@/api/business/supplier'
|
|
import {getSupplierList} from '@/api/business/supplier'
|
|
import {goodsTagItems} from '@/api/business/tag'
|
|
import {goodsTagItems} from '@/api/business/tag'
|
|
@@ -214,6 +259,7 @@ export default {
|
|
WangEditor,
|
|
WangEditor,
|
|
Upload,
|
|
Upload,
|
|
Spec,
|
|
Spec,
|
|
|
|
+ SpeTwo,
|
|
AddSupplier,
|
|
AddSupplier,
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
@@ -222,6 +268,7 @@ export default {
|
|
id: this.$route.query.id,
|
|
id: this.$route.query.id,
|
|
goodsCategoryItemsList: [],
|
|
goodsCategoryItemsList: [],
|
|
SupplierList: [],
|
|
SupplierList: [],
|
|
|
|
+ CouponList: [],
|
|
goodsTagItemsList: [],
|
|
goodsTagItemsList: [],
|
|
addData: {
|
|
addData: {
|
|
type: 1,
|
|
type: 1,
|
|
@@ -238,8 +285,25 @@ export default {
|
|
supplierId: [{required: true, message: '请选择供应商', trigger: 'change'}],
|
|
supplierId: [{required: true, message: '请选择供应商', trigger: 'change'}],
|
|
exchangeShow: [{required: true, message: '请选择是否支持盲豆兑换', trigger: 'change'}],
|
|
exchangeShow: [{required: true, message: '请选择是否支持盲豆兑换', trigger: 'change'}],
|
|
multiSku: [{required: true, message: '请选择SKU类型', trigger: 'change'}],
|
|
multiSku: [{required: true, message: '请选择SKU类型', trigger: 'change'}],
|
|
|
|
+ refId: [{required: true, message: '请选择关联采购优惠券', trigger: 'change'}],
|
|
value: [
|
|
value: [
|
|
- {required: true, message: '请输商品入价格', trigger: 'blur'},
|
|
|
|
|
|
+ {required: true, message: '请输入商品价格', trigger: 'blur'},
|
|
|
|
+ {
|
|
|
|
+ pattern: /^([1-9]\d*(\.\d{1,2})?|([0](\.([0][1-9]|[1-9]\d{0,1}))))$/,
|
|
|
|
+ message: "请输入正确的金额,最多两位小数",
|
|
|
|
+ trigger: ["blur", "change"]
|
|
|
|
+ }
|
|
|
|
+ ],
|
|
|
|
+ purchaseCost: [
|
|
|
|
+ {required: true, message: '请输入采购成本', trigger: 'blur'},
|
|
|
|
+ {
|
|
|
|
+ pattern: /^([1-9]\d*(\.\d{1,2})?|([0](\.([0][1-9]|[1-9]\d{0,1}))))$/,
|
|
|
|
+ message: "请输入正确的金额,最多两位小数",
|
|
|
|
+ trigger: ["blur", "change"]
|
|
|
|
+ }
|
|
|
|
+ ],
|
|
|
|
+ purchasePrice: [
|
|
|
|
+ {required: true, message: '请输入零售价', trigger: 'blur'},
|
|
{
|
|
{
|
|
pattern: /^([1-9]\d*(\.\d{1,2})?|([0](\.([0][1-9]|[1-9]\d{0,1}))))$/,
|
|
pattern: /^([1-9]\d*(\.\d{1,2})?|([0](\.([0][1-9]|[1-9]\d{0,1}))))$/,
|
|
message: "请输入正确的金额,最多两位小数",
|
|
message: "请输入正确的金额,最多两位小数",
|
|
@@ -273,7 +337,6 @@ export default {
|
|
],
|
|
],
|
|
description: [{required: true, message: '请输入商品详情', trigger: 'blur'}]
|
|
description: [{required: true, message: '请输入商品详情', trigger: 'blur'}]
|
|
},
|
|
},
|
|
-
|
|
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -322,7 +385,10 @@ export default {
|
|
exchangeShow,
|
|
exchangeShow,
|
|
multiSku,
|
|
multiSku,
|
|
value,
|
|
value,
|
|
|
|
+ refId,
|
|
exchangePrice,
|
|
exchangePrice,
|
|
|
|
+ purchaseCost,
|
|
|
|
+ purchasePrice,
|
|
originPrice,
|
|
originPrice,
|
|
discountRate,
|
|
discountRate,
|
|
cost,
|
|
cost,
|
|
@@ -337,10 +403,13 @@ export default {
|
|
} = res.data
|
|
} = res.data
|
|
this.addData = {
|
|
this.addData = {
|
|
value: accDiv(value, 100),
|
|
value: accDiv(value, 100),
|
|
|
|
+ purchaseCost: type == '3' ? accDiv(purchaseCost, 100) : '',
|
|
|
|
+ purchasePrice: type == '3' ? accDiv(purchasePrice, 100) : '',
|
|
cost: cost == '' || cost == null ? '' : accDiv(cost, 100),
|
|
cost: cost == '' || cost == null ? '' : accDiv(cost, 100),
|
|
goodsId,
|
|
goodsId,
|
|
title,
|
|
title,
|
|
type,
|
|
type,
|
|
|
|
+ refId: refId ? Number(refId): '',
|
|
goodsCode,
|
|
goodsCode,
|
|
picUrl,
|
|
picUrl,
|
|
merchantInfo,
|
|
merchantInfo,
|
|
@@ -366,10 +435,45 @@ export default {
|
|
this.$refs.spec.setSkuList(skuList)
|
|
this.$refs.spec.setSkuList(skuList)
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
+ this.getCouponList(refId)
|
|
})
|
|
})
|
|
|
|
+ }else {
|
|
|
|
+ this.getCouponList()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ typeChange(e) {
|
|
|
|
+ if(e == 2) {
|
|
|
|
+ this.addData.quantity = ''
|
|
|
|
+ this.addData.multiSku = 0
|
|
|
|
+ this.addData.purchaseCost = ''
|
|
|
|
+ this.addData.purchasePrice = ''
|
|
|
|
+ this.addData.refId = ''
|
|
|
|
+ }else if(e == 1){
|
|
|
|
+ this.addData.useLink = ''
|
|
|
|
+ this.addData.purchaseCost = ''
|
|
|
|
+ this.addData.purchasePrice = ''
|
|
|
|
+ this.addData.refId = ''
|
|
|
|
+ }else if(e == 3){
|
|
|
|
+ this.addData.useLink = ''
|
|
|
|
+ this.addData.exchangeShow = 0
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 获取采购优惠券下拉列表
|
|
|
|
+ getCouponList(refId) {
|
|
|
|
+ let data = {
|
|
|
|
+ type: 4,
|
|
|
|
+ status: "on",
|
|
|
|
+ isExcludePurchaseCoupon: true,
|
|
|
|
+ }
|
|
|
|
+ if(refId) {
|
|
|
|
+ data.couponId = refId
|
|
|
|
+ }
|
|
|
|
+ getCouponAllList(data).then(response => {
|
|
|
|
+ this.CouponList = response.rows || [];
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
getGoodsCategoryItems() {
|
|
getGoodsCategoryItems() {
|
|
goodsCategoryListTree("", {}).then(res => {
|
|
goodsCategoryListTree("", {}).then(res => {
|
|
this.goodsCategoryItemsList = res && res.rows
|
|
this.goodsCategoryItemsList = res && res.rows
|
|
@@ -405,14 +509,17 @@ export default {
|
|
this.$refs.addItem.validate((valid, items) => {
|
|
this.$refs.addItem.validate((valid, items) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
this.addData.skuList = skuList
|
|
this.addData.skuList = skuList
|
|
- const {value, categoryId, cost, exchangePrice, description, ...rest} = this.addData
|
|
|
|
|
|
+ const {value, type, categoryId, purchaseCost, purchasePrice, cost, exchangePrice, description, ...rest} = this.addData
|
|
addGoods({
|
|
addGoods({
|
|
...rest, ...{
|
|
...rest, ...{
|
|
value: accMul(value, 100),
|
|
value: accMul(value, 100),
|
|
|
|
+ purchaseCost: type == '3' ? accMul(purchaseCost, 100) : '',
|
|
|
|
+ purchasePrice: type == '3' ? accMul(purchasePrice, 100) : '',
|
|
cost: cost == '' || cost == null ? '' : accMul(cost, 100),
|
|
cost: cost == '' || cost == null ? '' : accMul(cost, 100),
|
|
exchangePrice: accMul(exchangePrice, 1),
|
|
exchangePrice: accMul(exchangePrice, 1),
|
|
description: encodeURI(description),
|
|
description: encodeURI(description),
|
|
categoryId: categoryId[1],
|
|
categoryId: categoryId[1],
|
|
|
|
+ type,
|
|
}
|
|
}
|
|
}).then(res => {
|
|
}).then(res => {
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|