Commit 48f6ef1f authored by verestrasz's avatar verestrasz

update

parent 8c210e14
// 类目-列表查询
export const helpCategoryList = {
url: '/help/category/list',
method: 'GET',
dealReqData: ({ pageNum, pageSize }) => {
return { pageNum, pageSize }
}
}
// 类目-列表查询
export const helpInfoList = {
url: '/help/info/list',
method: 'GET',
dealReqData: ({ pageNum, pageSize, keyWord }) => {
return { pageNum, pageSize, keyWord }
}
}
// 帮助中心-帮助-新增
export const addHelp = {
url: '/help/info/save',
method: 'POST',
dealReqData: (saveDTO) => {
return saveDTO
}
}
// 帮助中心-帮助-新增
export const addCategory = {
url: '/help/category/save',
method: 'POST',
dealReqData: (saveDTO) => {
return saveDTO
}
}
// 帮助中心-帮助-主键查询
export const searchInfoId = {
url: `/help/info`,
method: 'GET',
dealUrl: (url, infoId) => {
return `${url}/${infoId}`
}
}
// 帮助中心-帮助-删除
export const deleteInfoId = {
url: `/help/info/delete`,
method: 'DELETE',
dealUrl: (url, infoId) => {
return `${url}/${infoId}`
}
}
// 帮助中心-帮助-编辑
export const updateHelp = {
url: '/help/info/update',
method: 'PUT',
dealReqData: ({ detail, helpCategoryId, infoId, title, updateTime }) => {
return { detail, helpCategoryId, infoId, title, updateTime }
}
}
......@@ -79,7 +79,8 @@ export default {
vKey: ''
},
codeSrc: '',
appid: '2094772907',
// appid: '2094772907',
appid: '2031161403',
loginLoading: false
}
},
......
......@@ -120,25 +120,50 @@ export const TradTypeObj = {
[TradType.GoodsSales]: '商品销售',
[TradType.GoodsRefund]: '商品退货'
}
export const ShopType = {
export const SalesType = {
ORDINARY: 1,
PRE_SALE: 2,
AUCTION: 3,
PACK: 5,
NFT: 6
BLINDBOX: 4,
FREE: 5
}
export const ShopTypeObj = {
[ShopType.ORDINARY]: {
export const SalesTypeObj = {
[SalesType.ORDINARY]: {
label: '普通',
color: 'default'
},
[ShopType.PRE_SALE]: {
[SalesType.PRE_SALE]: {
label: '预售',
color: 'default'
},
[ShopType.AUCTION]: {
label: '竞拍',
[SalesType.AUCTION]: {
label: '拍卖',
color: 'default'
},
[SalesType.BLINDBOX]: {
label: '盲盒',
color: 'default'
},
[SalesType.FREE]: {
label: '免费领取',
color: 'default'
}
}
export const ShopType = {
ORDINARY: 1,
FICTITIOUS: 2,
PACK: 3,
NFT: 4
}
export const ShopTypeObj = {
[ShopType.ORDINARY]: {
label: '普通',
color: 'default'
},
[ShopType.FICTITIOUS]: {
label: '虚拟',
color: 'default'
},
[ShopType.PACK]: {
......
export function deepCopy (oldObj) {
let typeString = obj => {
var cons = Object.prototype.toString.call(obj).slice(8, -1)
return (cons === 'Array' || cons === 'Object')
}
if (typeString(oldObj)) {
var newObj = oldObj.constructor()
for (let i in oldObj) {
if (oldObj.hasOwnProperty(i)) {
newObj[i] = typeString(oldObj[i]) ? deepCopy(oldObj[i]) : oldObj[i]
}
}
return newObj
} else {
return oldObj
}
}
......@@ -3,8 +3,8 @@
<div class="item">
<label class="label">商品通证:</label>
<!-- <RadioGroup v-model="data.useNft">
<Radio label="0" :disabled="isDetail || isEdit || isAgain" class="ivu-radio"></Radio>
<Radio label="1" :disabled="isDetail || isEdit || isAgain" class="ivu-radio"></Radio>
<Radio label="0" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio"></Radio>
<Radio label="1" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio"></Radio>
</RadioGroup> -->
<span>{{data.coinName}}</span>
</div>
......@@ -23,13 +23,12 @@
</div>
<div class="item">
<label class="label">商品类型:</label>
<RadioGroup v-model="data.type">
<!-- <Radio label="1" :disabled="isDetail || isEdit || isAgain" class="ivu-radio">普通</Radio>
<Radio label="2" :disabled="isDetail || isEdit || isAgain" class="ivu-radio">虚拟(不支持提货)</Radio> -->
<!-- <Radio label="3" :disabled="isDetail || isEdit || isAgain" class="ivu-radio">打包</Radio> -->
<!-- <Radio label="5" :disabled="isDetail || isEdit || isAgain" class="ivu-radio">打包</Radio> -->
<!-- <Radio label="6" :disabled="isDetail || isEdit || isAgain" class="ivu-radio">NFT</Radio> -->
<span style="font-size:15px;">NFT</span>
<RadioGroup v-model="data.type" :readonly="isDetail || isEdit">
<Radio label="1" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio">普通</Radio>
<Radio label="2" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio">虚拟(不支持提货)</Radio>
<!-- <Radio label="3" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio">打包</Radio> -->
<!-- <Radio label="5" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio">打包</Radio> -->
<!-- <Radio label="6" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio">NFT</Radio> -->
</RadioGroup>
</div>
<div class="item">
......@@ -39,7 +38,7 @@
:rows="5"
placeholder="请填写商品描述"
v-model="data.description"
:readonly="isDetail||isEdit"
:readonly="isDetail"
:maxlength="250"
/>
</div>
......@@ -100,15 +99,15 @@
<!-- <div class="item">
<label class="label">应用NFT:</label>
<RadioGroup v-model="data.useNft">
<Radio label="0" :disabled="isDetail || isEdit || isAgain" class="ivu-radio"></Radio>
<Radio label="1" :disabled="isDetail || isEdit || isAgain" class="ivu-radio"></Radio>
<Radio label="0" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio"></Radio>
<Radio label="1" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio"></Radio>
</RadioGroup>
</div> -->
<!-- <div class="item">
<label class="label">正品认证:</label>
<RadioGroup v-model="data.type">
<Radio label="1" :disabled="isDetail || isEdit || isAgain" class="ivu-radio">申请</Radio>
<Radio label="2" :disabled="isDetail || isEdit || isAgain" class="ivu-radio">不申请</Radio>
<Radio label="1" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio">申请</Radio>
<Radio label="2" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio">不申请</Radio>
</RadioGroup>
</div> -->
</info-con>
......@@ -143,6 +142,10 @@ export default {
isAgain: {
type: Boolean,
default: false
},
isDraft: {
type: Boolean,
default: false
}
},
data () {
......
......@@ -9,13 +9,13 @@
:maxNum="5"
v-model="data.detailPictures"
:defaultList="data.defaultDetailPicture"
:readonly="isDetail"
:readonly="isDetail "
showWatch
/>
<div class="tip" v-if="!isDetail">提示:最多可上传5张,建议尺寸375 * 365,大小不得超过6MB。</div>
</div>
</div>
<div class="item" v-show="!isDetail || !!data.video">
<div class="item" v-show="(!isDetail&&!isEdit) || !!data.video">
<label class="label">商品视频:</label>
<div class="upload-con">
<file-upload
......@@ -29,7 +29,7 @@
:readonly="isDetail"
showWatch
/>
<div class="tip" v-if="!isDetail">提示:仅可上传一张,商品宣传视频,用于详情页展示,建议尺寸375 * 365,大小不得超过50MB。(非必传)</div>
<div class="tip" v-if="!isDetail">提示:仅可上传一张,商品宣传视频,用于详情页展示,建议尺寸375 * 365,大小不得超过50MB(非必传)。</div>
</div>
</div>
<div class="item">
......@@ -41,30 +41,13 @@
:maxNum="1"
v-model="data.thumbList"
:defaultList="data.defaultThumbList"
:readonly="isDetail"
:readonly="isDetail "
showWatch
/>
<div class="tip" v-if="!isDetail">提示:仅可上传一张,建议尺寸100 * 100,大小不得超过6MB。</div>
<!-- {{data.thumbList}} -->
</div>
</div>
<div class="item" v-show="!isDetail || !!data.nftFile">
<label class="label">NFT附件:</label>
<div class="upload-con">
<file-upload
type="NFT"
:width="150"
:iconSize="26"
:maxNum="1"
:maxSize="100"
v-model="data.nftEnclosureList"
:defaultList="data.defaultNftEnclosureList"
:readonly="isDetail"
showWatch
/>
<div class="tip" v-if="!isDetail">提示:仅可上传一份附件,大小不得超过100MB。(非必传)</div>
</div>
</div>
<div class="item">
<label class="label">详情描述:</label>
<div class="editor-con">
......@@ -125,7 +108,6 @@ export default {
default: {
video: '',
videoList: [],
nftFile: '',
videoThumb: '',
videoThumbList: [],
thumb: '',
......@@ -135,15 +117,17 @@ export default {
defaultDetailPicture: [],
defaultVideoList: [],
defaultVideoThumbList: [],
defaultThumbList: [],
nftEnclosureList: [],
defaultNftEnclosureList: []
defaultThumbList: []
}
},
isDetail: {
type: Boolean,
default: false
},
isEdit: {
type: Boolean,
default: false
},
status: ''
},
computed: {
......
......@@ -8,44 +8,58 @@
<Icon type="md-bookmark" color="#2d8cf0" :size="28" />
<label>{{ title }}</label>
</div>
<base-info :data="form.baseInfo" :isDetail="isDetail" :isEdit="isEdit" :isAgain="isAgain"/>
<base-info :data="form.baseInfo" :isDraft="isDraft" :isDetail="isDetail" :isEdit="isEdit" :isAgain="isAgain"/>
<sale-info
:data="form.saleInfo"
:isDetail="isDetail"
:isEdit="isEdit"
:isAgain="isAgain"
:isSelf="isSelf"
:status="status"
:isDraft="isDraft"
:shopStatus="status"
:availableNumber="availableNumber"
v-if="form.baseInfo.type!=6 && form.baseInfo.type!=5"
/>
<decipt-info :data="form.deciptInfo" :isDetail="isDetail" :status="status"/>
<decipt-info :data="form.deciptInfo" :isDetail="isDetail" :isEdit="isEdit" :shopStatus="status"/>
<info-con title="销售信息:" class="base-info-con">
<!-- <div class="series-info">
<div class="series-info" v-if="(form.baseInfo.type==1||form.baseInfo.type==3)&&form.saleInfo.commodityPass!=0">
<label class="label">是否允许延后提货:</label>
<i-switch v-model="form.delayDelivery" :disabled="delayDeliveryDisabled || isDetail"/>
</div> -->
<i-switch v-model="form.delayDelivery" :disabled="delayDeliveryDisabled || isDetail || isEdit"/>
</div>
<div class="series-info">
<label class="label">退换货类型:</label>
<RadioGroup v-model="form.returnType">
<Radio label="0" :disabled="isDetail" class="ivu-radio">不支持</Radio>
<Radio label="1" :disabled="isDetail" class="ivu-radio">七天无理由退货</Radio>
<Radio label="2" :disabled="isDetail" class="ivu-radio">
<RadioGroup v-model="backType">
<Radio label="1" :disabled="isDetail || isEdit || isDraft" class="ivu-radio">不支持</Radio>
<Radio label="2" :disabled="isDetail || isEdit || isDraft" class="ivu-radio">七天无理由退货</Radio>
<Radio label="3" :disabled="isDetail || isEdit || isDraft" class="ivu-radio">
自定义
<Input v-model="form.returnReason" :disabled="isDetail" type="textarea" placeholder="请输入退货缘由" style="width: 200px" />
<Input v-model="customDays" :disabled="isDetail || isEdit || isDraft" style="width: 80px" />
无理由退款
</Radio>
</RadioGroup>
</div>
<div class="series-info">
<label class="label">商品备注:</label>
<Input v-model="form.note" :readonly="isDetail" type="textarea" placeholder="商品备注(非必填)" style="width: 200px" />
<Input v-model="form.note" :readonly="isDetail " type="textarea" placeholder="商品备注(非必填)" style="width: 200px" />
</div>
</info-con>
<info-con title="溯源信息" class="base-info-con">
<div class="series-info">
<label class="label">溯源编号:</label>
<Input v-model="form.traceabilityNumber" :readonly="isDetail" placeholder="请输入溯源系统的商品溯源编号(非必填)" style="width: 400px" />
<Input v-model="form.traceabilityNumber" :readonly="isDetail" placeholder="请输入溯源系统的商品溯源编号(非必填 100位以内)" style="width: 400px" />
</div>
</info-con>
<div class="submit-bottom">
<div class="submit-con">
<Button
type="primary"
@click="handleDraft"
v-if="!isDetail"
:loading="draftLoading"
>存为草稿</Button
>
</div>
<div class="submit-con">
<Button
type="primary"
......@@ -55,6 +69,8 @@
>提交商品信息</Button
>
</div>
</div>
</Card>
</div>
</template>
......@@ -77,12 +93,12 @@ export default {
},
computed: {
title () {
if (this.routeName === 'commodity_update_good') {
if (this.routeName === 'update_good') {
return '编辑商品 - 填写商品信息'
} else if (this.routeName == 'commodity_good_detail') {
} else if (this.routeName == 'good_detail') {
return '商品详情'
// this.isSelf // : `商品详情( 品牌商:${this.form.brandName} )`
} else if (this.routeName === 'commodity_again_good') {
} else if (this.routeName === 'again_good') {
return '重新发布商品 - 填写商品信息'
} else {
return '发布商品 - 填写商品信息'
......@@ -100,6 +116,9 @@ export default {
isAgain () {
return this.routeName === 'commodity_again_good'
},
isDraft () {
return this.routeName === 'commodity_draft_good'
},
isSelf () {
return this.form.brandId === this.$store.state.admin.brandId
},
......@@ -120,26 +139,42 @@ export default {
baseInfo: {
name: '', // 商品名称
description: '', // 商品描述
prop: [{ name: '', val: '' }], // 商品属性
// prop: [{ name: '', val: '' }], // 商品属性
prop: [],
categoryId: [], // 类目选择
type: '6', // 商品类型
type: '1', // 商品类型
useNft: '0',
coinName: ''
},
saleInfo: {
sku: [],
imgObj: {},
commodityPass: 3,
saleStartTime: '',
saleEndTime: '',
drawStartTime: '',
drawEndTime: '',
fixedProportion: '',
fixedAmount: '',
depositType: '',
price: '',
startPrice: '',
buyerDeposit: '',
priceIncrease: '',
delayPayTime: '',
endTime: '',
stock: '',
salesType: 1,
originalPrice: '',
// weight: '',
weight: '',
nftSalesType: '',
stock: ''
hash:'',
purchase_limit:0
// statu:this.status
},
deciptInfo: {
video: '',
videoList: [],
nftFile: '',
nftEnclosureList: [],
videoThumb: '',
thumb: '',
thumbList: [],
......@@ -147,22 +182,24 @@ export default {
detailDescribe: '',
defaultDetailPicture: [],
defaultVideoList: [],
defaultThumbList: [],
defaultNftEnclosureList: []
defaultThumbList: []
// statu:this.status
},
returnType: '0', // 退货类型
returnType: '', // 退货类型
returnReason: '', // 退货理由
note: '', // 商品备注
stock: '', // 积分库存
pnum: '', // 积分数量
traceabilityNumber: '', // 溯源编号
delayDelivery: false // 延迟提货
},
loading: true,
expressList: [],
submitLoading: false,
commodityPassId: '',
availableNumber: '',
skuId: ''
draftLoading: false,
backType: '',
customDays: '',
availableNumber: ''
}
},
methods: {
......@@ -197,12 +234,13 @@ export default {
})
}
},
requestGoodDetail (goodsId) {
requestGoodDetail (id, apiName) {
this.loading = true
this.api({
apiName: 'getGoodDetail',
postdata: { goodsId },
apiName,
postdata: { id },
success: (res) => {
if (res.data) {
let {
brandId,
brandName,
......@@ -224,16 +262,28 @@ export default {
returnReason,
categoryName,
categoryIds,
preSaleVO,
auctionVO,
commodityPass,
nftFile
useNft,
salesType,
goodsId
} = res.data
this.form.goodsId = goodsId
this.form.brandId = brandId
this.form.brandName = brandName
// this.form.templateId = templateId
this.form.note = note
this.form.returnType = returnType.toString()
// this.form.returnType = returnType.toString()
if (returnType == 0) {
this.backType = '1'
} else if (returnType == 7) {
this.backType = '2'
} else {
this.backType = '3'
this.customDays = returnType
// form.returnType = this.customDays
}
this.form.returnReason = returnReason
this.form.traceabilityNumber = traceabilityNumber
if (delayDelivery == 0) {
......@@ -241,59 +291,70 @@ export default {
} else {
this.form.delayDelivery = true
}
if (auctionVO) {
this.form.saleInfo.buyerDeposit = auctionVO.buyerDeposit
this.form.saleInfo.startPrice = auctionVO.startPrice
this.form.saleInfo.priceIncrease = auctionVO.priceIncrease
this.form.saleInfo.delayPayTime = auctionVO.delayPayTime
this.form.saleInfo.endTime = auctionVO.endTime ? formatTime(auctionVO.endTime) : ''
// this.form.saleInfo.name = auctionVO.name
}
this.form.baseInfo = {
name,
description,
coinName: skus[0].coinName,
prop: JSON.parse(prop),
type: type.toString(),
categoryId: this.isAgain ? JSON.parse(categoryIds) : categoryName
}
// let newSku = []
// skus.forEach((item) => {
// let { image, propertyList } = item
// let upload = {
// imageList: [image],
// defaultImgList: [image]
// }
// let prop = {}
// propertyList.forEach((pItem) => {
// prop[pItem.propKey] = pItem.propVal
// })
// newSku.push({ ...item, ...prop, upload })
// })
// this.form.saleInfo.sku = newSku
categoryId: (this.isDraft || this.isAdd) ? JSON.parse(categoryIds) : categoryName,
useNft: useNft.toString()
}
if(res.data.skus&&res.data.skus.length>0){
this.skuId=res.data.skus[0].skuId
}
this.commodityPassId = skus[0].commodityPassId
// console.log('1234', skus[0].coinName)
// console.log('123', this.form.baseInfo.coinName)
this.form.saleInfo = {
originalPrice: skus[0].originalPrice,
// weight: skus[0].weight,
weight: skus[0].weight,
nftSalesType: skus[0].nftSalesType,
stock: skus[0].stock
stock: skus[0].stock,
hash: skus[0].hash,
purchase_limit:0
}
this.availableNumber = skus[0].availableNumber
this.form.saleInfo.commodityPass = commodityPass
this.skuId = skus[0].skuId
this.form.saleInfo.salesType = salesType
this.form.deciptInfo = {
nftFile,
nftEnclosureList: [nftFile],
video,
videoList: [video],
videoThumb,
thumb,
thumbList: [thumb],
thumbList: thumb ? [thumb] : [],
detailPictures: JSON.parse(imgList),
detailDescribe: detail,
defaultDetailPicture: JSON.parse(imgList),
defaultVideoList: [video],
defaultThumbList: [thumb],
defaultNftEnclosureList: [nftFile]
defaultThumbList: thumb ? [thumb] : []
}
if (!video) {
this.form.deciptInfo.video = ''
this.form.deciptInfo.defaultVideoList = []
}
if (!nftFile) {
this.form.deciptInfo.nftFile = ''
this.form.deciptInfo.defaultNftEnclosureList = []
if (salesType == 2) {
this.form.saleInfo.depositType = preSaleVO.depositType.toString()
if (this.form.saleInfo.depositType == 1) {
this.form.saleInfo.fixedProportion = preSaleVO.deposit
} else if (this.form.saleInfo.depositType == 2) {
this.form.saleInfo.fixedAmount = preSaleVO.deposit
}
// this.form.deposit = preSaleVO.deposit
this.form.saleInfo.drawEndTime = preSaleVO.drawEndTime ? formatTime(preSaleVO.drawEndTime) : ''
this.form.saleInfo.drawStartTime = preSaleVO.drawStartTime ? formatTime(preSaleVO.drawStartTime) : ''
this.form.saleInfo.saleEndTime = preSaleVO.saleEndTime ? formatTime(preSaleVO.saleEndTime) : ''
this.form.saleInfo.saleStartTime = preSaleVO.saleStartTime ? formatTime(preSaleVO.saleStartTime) : ''
}
}
},
complete: () => {
......@@ -304,13 +365,17 @@ export default {
initData () {
let routeName = this.$route.name
let { goodsId, labelName, commodityPassId, availableNumber } = this.$route.query
// console.log(this.$route)
this.form.baseInfo.coinName = labelName
this.commodityPassId = commodityPassId
this.availableNumber = availableNumber
this.form.goodsId = goodsId
this.routeName = routeName
if (routeName == 'commodity_update_good' || routeName == 'commodity_good_detail' || routeName == 'commodity_again_good') {
this.requestGoodDetail(goodsId)
if (routeName == 'commodity_update_good' || routeName == 'commodity_good_detail' || routeName == 'commodity_again_good' || routeName == 'commodity_draft_good') {
// console.log('13567')
this.requestGoodDetail(goodsId, 'getGoodDetail')
} else if (routeName == 'commodity_add_good') {
this.requestGoodDetail(commodityPassId, 'getGoodDetailforouttoken')
} else {
this.loading = false
}
......@@ -332,26 +397,34 @@ export default {
republish: '',
skuId: '',
stock: '',
// weight: '',
commodityPassId: ''
weight: '',
skuName: '',
commodityPassId: '',
hash:''
}],
packageDTO: {},
nftdto: {}
packageDTO: {}
// nftdto: {}
}
let {
goodsId,
// templateId,
baseInfo,
saleInfo,
deciptInfo,
returnType,
returnReason,
// returnType,
// returnReason,
note,
deposit,
pnum,
traceabilityNumber,
delayDelivery
} = this.form
form.goodsId = goodsId
if(baseInfo.type==4){
form.purchaseLimit=1
}else{
form.purchaseLimit=saleInfo.purchaseLimit
}
if (!baseInfo) {
return { errMsg: '请完善基本信息!' }
}
......@@ -376,22 +449,118 @@ export default {
(!baseInfo.categoryId ||
baseInfo.categoryId.length === 0)
) {
return { errMsg: '请填写 基本信息 - 类目选择!' }
return { errMsg: '请选择 基本信息 - 所属类目!' }
}
if (!baseInfo.useNft) {
return { errMsg: '请填写 基本信息 - 是否应用NFT!' }
}
form = { ...form, ...baseInfo }
// 销售信息
if (!saleInfo.originalPrice) {
return { errMsg: '请填写销售价格!' }
if (!saleInfo.salesType) {
return { errMsg: '请选择商品类型' }
}
form.salesType = saleInfo.salesType
if (!saleInfo.depositType && saleInfo.salesType == 2) {
return { errMsg: '请选择预售定金类型' }
}
form.preSaleDTO.depositType = saleInfo.depositType
// 首付比例
if (saleInfo.salesType == 2) {
if (saleInfo.depositType == 1) {
deposit = saleInfo.fixedProportion
} else {
deposit = saleInfo.fixedAmount
}
}
if (!deposit && saleInfo.salesType == 2) {
return { errMsg: '请填写首付比例' }
}
form.preSaleDTO.deposit = deposit
// 预计提货开始时间
if (!saleInfo.drawStartTime && saleInfo.salesType == 2) {
return { errMsg: '请填写预计提货开始时间' }
}
form.preSaleDTO.drawStartTime = saleInfo.drawStartTime
// 预计提货结束时间
if (!saleInfo.drawEndTime && saleInfo.salesType == 2) {
return { errMsg: '请填写预计提货结束时间' }
}
form.preSaleDTO.drawEndTime = saleInfo.drawEndTime
// 预售开始时间
if (!saleInfo.saleStartTime && saleInfo.salesType == 2) {
return { errMsg: '请填写预售开始时间' }
}
// if (!saleInfo.weight) {
// return { errMsg: '请填写商品重量!' }
form.preSaleDTO.saleStartTime = saleInfo.saleStartTime
// 预售结束时间
if (!saleInfo.saleEndTime && saleInfo.salesType == 2) {
return { errMsg: '请填写预售结束时间' }
}
form.preSaleDTO.saleEndTime = saleInfo.saleEndTime
// 买家起拍价
if (!saleInfo.startPrice && saleInfo.salesType == 3) {
return { errMsg: '请填写起拍价' }
}
// if ((saleInfo.startPrice < 0 || !/^\d+$/.test(saleInfo.startPrice)) && saleInfo.salesType == 3) {
// return { errMsg: '起拍价格式输入有误!' }
// }
if (saleInfo.startPrice < 0 && saleInfo.salesType == 3) {
return { errMsg: '拍卖起拍价不能小于0!' }
}
form.auctionDTO.startPrice = saleInfo.startPrice
// console.log('333', saleInfo.buyerDeposit)
// 买家保证金
if (!saleInfo.buyerDeposit && saleInfo.salesType == 3) {
return { errMsg: '请填写拍卖保证金' }
}
// if ((saleInfo.buyerDeposit < 0 || !/^\d+$/.test(saleInfo.buyerDeposit)) && saleInfo.salesType == 3) {
// return { errMsg: '拍卖保证金格式输入有误!' }
// }
if (saleInfo.buyerDeposit < 0 && saleInfo.salesType == 3) {
return { errMsg: '拍卖保证金不能小于0!' }
}
if (saleInfo.buyerDeposit > saleInfo.startPrice && saleInfo.salesType == 3) {
return { errMsg: '请填写拍卖保证金不能大于起拍价' }
}
form.auctionDTO.buyerDeposit = saleInfo.buyerDeposit
// 出价最小增幅
if (!saleInfo.priceIncrease && saleInfo.salesType == 3) {
return { errMsg: '请填写出价最小增幅' }
}
// if ((saleInfo.priceIncrease < 0 || !/^\d+$/.test(saleInfo.priceIncrease)) && saleInfo.salesType == 3) {
// return { errMsg: '出价最小增幅格式输入有误!' }
// }
if (saleInfo.priceIncrease < 0 && saleInfo.salesType == 3) {
return { errMsg: '最小增幅不能小于0!' }
}
form.auctionDTO.priceIncrease = saleInfo.priceIncrease
if (!saleInfo.endTime && saleInfo.salesType == 3) {
return { errMsg: '请填写拍卖结束时间' }
}
form.auctionDTO.endTime = saleInfo.endTime
if (!saleInfo.delayPayTime && saleInfo.salesType == 3) {
return { errMsg: '请填写延后天数' }
}
// console.log('1111', saleInfo.delayPayTime)
form.auctionDTO.delayPayTime = saleInfo.delayPayTime
if (!saleInfo.originalPrice && saleInfo.salesType == 1) {
return { errMsg: '请填写销售价格!' }
}
if (!saleInfo.weight && baseInfo.type != 2) {
return { errMsg: '请填写商品重量!' }
}
if (!saleInfo.nftSalesType) {
return { errMsg: '请选择NFT销售方式!' }
}
if (!saleInfo.stock && saleInfo.nftSalesType == 2) {
return { errMsg: '请填写拷贝数量!' }
}
if (saleInfo.stock > 100000 && saleInfo.nftSalesType == 2) {
return { errMsg: '请填写拷贝不能超过10万' }
}
if (!saleInfo.hash) {
return { errMsg: '请填写溯源哈希' }
}
form.commodityPass = saleInfo.commodityPass
// 图文信息
if (!deciptInfo) {
......@@ -420,69 +589,99 @@ export default {
if (deciptInfo.videoList && deciptInfo.videoList.length !== 0) {
form.video = deciptInfo.videoList[0]
form.videoPoster = getPosterFromVideoUrl(form.video)
} else {
form.video = ''
form.videoPoster = ''
}
if (deciptInfo.nftEnclosureList && deciptInfo.nftEnclosureList.length !== 0) {
form.nftFile = deciptInfo.nftEnclosureList[0]
// form.videoPoster = getPosterFromVideoUrl(form.video)
} else {
form.nftFile = ''
}
// console.log('form',form)
// 快递模板
// if (!templateId) {
// return { errMsg: '请选择快递模板!' }
// }
// form.templateId = templateId
// 退货类型
if (!returnType && returnType != 0) {
if (!this.backType) {
return { errMsg: '请选择退货类型' }
}
form.returnType = returnType
// 自定义退货(退货理由)
if (returnReason == '' && returnType == 2) {
return { errMsg: '请描述退货理由' }
if (this.customDays == '' && this.backType == 3) {
return { errMsg: '请自定义多少天可以退货' }
}
if (this.backType == 1) {
form.returnType = 0
} else if (this.backType == 2) {
form.returnType = 7
} else if (this.backType == 3) {
if(parseInt(this.customDays)>15){
return { errMsg: '请自定义最多15天!' }
}
form.returnType = this.customDays
}
form.returnReason = returnReason
// 商品备注
// if (!note) {
// return { errMsg: '请填写商品备注' }
// }
form.note = note
// 积分库存
// if (!stock && baseInfo.type == 4) {
// return { errMsg: '请填写库存' }
// }
// form.pointsExchangeDTO.stock = stock
// // 积分数量
// if (!pnum && baseInfo.type == 4) {
// return { errMsg: '请填写积分数量' }
// }
form.pointsExchangeDTO.pnum = pnum
if (traceabilityNumber.length > 100) {
return { errMsg: '溯源系统的商品溯源编号不能大于100位' }
}
form.traceabilityNumber = traceabilityNumber
form.delayDelivery = delayDelivery == true ? '1' : '0'
return { errMsg, form }
},
handleSubmit () {
let { errMsg, form } = this.checkForm()
// console.log('form', form)
if (errMsg) {
return this.$Notice.warning({ title: errMsg })
}
if (form.preSaleDTO.drawStartTime > form.preSaleDTO.drawEndTime) {
return this.$Notice.warning('提货开始时间不能大于结束时间')
}
if (form.preSaleDTO.saleStartTime > form.preSaleDTO.saleEndTime) {
return this.$Notice.warning('预售开始时间不能大于结束时间')
}
if (!errMsg) {
form.categoryId = JSON.stringify(form.categoryId)
// console.log('145', form.prop)
form.prop = JSON.stringify(form.prop)
form.type = JSON.parse(form.type)
}
if (!errMsg) {
if (form.type == 6) {
// form.commodityPass = 0
form.returnType = JSON.parse(form.returnType)
form.preSaleDTO.drawStartTime = new Date(form.preSaleDTO.drawStartTime).getTime()
form.preSaleDTO.drawEndTime = new Date(form.preSaleDTO.drawEndTime).getTime() + 86399000
form.preSaleDTO.saleStartTime = new Date(form.preSaleDTO.saleStartTime).getTime()
form.preSaleDTO.saleEndTime = new Date(form.preSaleDTO.saleEndTime).getTime() + 86399000
form.auctionDTO.endTime = new Date(form.auctionDTO.endTime).getTime() + 86399000
}
if (!errMsg) {
console.log(this.skuId)
form.skuList.forEach(item => {
item.originalPrice = this.form.saleInfo.originalPrice
item.coinName = this.form.baseInfo.coinName
item.propertyList = [{ propKey: '规格', propVal: '默认' }]
item.image = form.thumb
item.nftSalesType = this.form.saleInfo.nftSalesType
// item.weight = this.form.saleInfo.weight
item.weight = this.form.saleInfo.weight
item.commodityPassId = this.commodityPassId
item.skuId = this.skuId
item.stock = item.nftSalesType == 1 ? this.availableNumber : this.form.saleInfo.stock
item.hash = this.form.saleInfo.hash
})
}
}
// form.detail
var regex1 = new RegExp("(i?)(\<p)(?!(.*?style=['\"](.*)['\"])[^\>]+\>)", 'gmi')
form.detail = form.detail.replace(regex1, '$2 style="padding:0 10px"$3')
// console.log('form', form)
let apiName = this.isAdd ? 'addGood' : this.isAgain ? 'republishGood' : 'updateGood'
let title = this.isAdd ? '添加成功!' : this.isAgain ? '重新发布成功!' : '编辑成功!'
console.log('form', form)
let apiName = (this.isAdd || this.isDraft) ? 'addGood' : 'updateGood'
let title = this.isAdd ? '添加成功!' : '编辑成功!'
this.submitLoading = true
this.api({
apiName,
......@@ -498,6 +697,137 @@ export default {
this.submitLoading = false
}
})
},
handleDraft () {
let form = {
auctionDTO: {},
pointsExchangeDTO: {},
preSaleDTO: {},
skuList: [{
coinName: '',
originalPrice: '',
propertyList: [{
propKey: '',
propVal: ''
}],
republish: '',
skuId: '',
stock: '',
skuName: '',
weight: ''
}],
packageDTO: {}
// nftdto: {}
}
let {
goodsId,
// templateId,
baseInfo,
saleInfo,
deciptInfo,
// returnType,
// returnReason,
note,
deposit,
pnum,
traceabilityNumber,
delayDelivery
} = this.form
form.goodsId = goodsId
if (!baseInfo.name) {
return { errMsg: '请填写 基本信息 - 商品名称!' }
}
form = { ...form, ...baseInfo }
// 销售信息
form.salesType = saleInfo.salesType
form.preSaleDTO.depositType = saleInfo.depositType
// 首付比例
if (saleInfo.salesType == 2) {
if (saleInfo.depositType == 1) {
deposit = saleInfo.fixedProportion
} else {
deposit = saleInfo.fixedAmount
}
}
form.preSaleDTO.deposit = deposit
// 预计提货开始时间
form.preSaleDTO.drawStartTime = saleInfo.drawStartTime
// 预计提货结束时间
form.preSaleDTO.drawEndTime = saleInfo.drawEndTime
// 预售开始时间
form.preSaleDTO.saleStartTime = saleInfo.saleStartTime
// 预售结束时间
form.preSaleDTO.saleEndTime = saleInfo.saleEndTime
// 买家起拍价
form.auctionDTO.startPrice = saleInfo.startPrice
// 买家保证金
form.auctionDTO.buyerDeposit = saleInfo.buyerDeposit
// 出价最小增幅
form.auctionDTO.priceIncrease = saleInfo.priceIncrease
form.auctionDTO.endTime = saleInfo.endTime
// console.log('1111', saleInfo.delayPayTime)
form.auctionDTO.delayPayTime = saleInfo.delayPayTime
form.commodityPass = saleInfo.commodityPass
// 图文信息
form.thumb = deciptInfo.thumbList[0]
form.imgList = JSON.stringify(deciptInfo.detailPictures)
form.detail = deciptInfo.detailDescribe
if (deciptInfo.videoList && deciptInfo.videoList.length !== 0) {
form.video = deciptInfo.videoList[0]
form.videoPoster = getPosterFromVideoUrl(form.video)
}
if (this.backType == 1) {
form.returnType = 0
} else if (this.backType == 2) {
form.returnType = 7
} else if (this.backType == 3) {
form.returnType = this.customDays
}
form.note = note
form.pointsExchangeDTO.pnum = pnum
if (traceabilityNumber.length > 100) {
return { errMsg: '溯源系统的商品溯源编号不能大于100位' }
}
form.traceabilityNumber = traceabilityNumber
form.delayDelivery = delayDelivery == true ? '1' : '0'
form.categoryId = JSON.stringify(form.categoryId)
form.prop = JSON.stringify(form.prop)
form.type = JSON.parse(form.type)
// form.returnType = form.returnType ? JSON.parse(form.returnType) : ''
form.preSaleDTO.drawStartTime = new Date(form.preSaleDTO.drawStartTime).getTime()
form.preSaleDTO.drawEndTime = new Date(form.preSaleDTO.drawEndTime).getTime() + 86399000
form.preSaleDTO.saleStartTime = new Date(form.preSaleDTO.saleStartTime).getTime()
form.preSaleDTO.saleEndTime = new Date(form.preSaleDTO.saleEndTime).getTime() + 86399000
form.auctionDTO.endTime = new Date(form.auctionDTO.endTime).getTime() + 86399000
form.skuList.forEach(item => {
item.originalPrice = this.form.saleInfo.originalPrice
item.coinName = this.form.baseInfo.coinName
item.propertyList = [{ propKey: '规格', propVal: '默认' }]
item.image = form.thumb
item.nftSalesType = this.form.saleInfo.nftSalesType
item.weight = this.form.saleInfo.weight
item.commodityPassId = this.commodityPassId
item.skuId = this.skuId
console.log(this.skuId)
item.stock = item.nftSalesType == 1 ? this.availableNumber : this.form.saleInfo.stock
item.hash = this.form.saleInfo.hash
})
this.draftLoading = true
this.api({
apiName: 'draftGood',
postdata: form,
success: (res) => {
// 关闭当前标签页
let route = this.$route
let toRouteName = 'product_list'
this.closeTag({ route, toRouteName })
this.$Notice.success({ title: '保存成功!' })
},
complete: () => {
this.draftLoading = false
}
})
}
},
......@@ -559,9 +889,18 @@ export default {
justify-content: space-around;
}
}
.submit-bottom{
margin: 0 auto;
width: 50%;
display: flex;
justify-content: space-around;
.submit-con {
text-align: center;
// text-align: center;
}
}
// .submit-con {
// text-align: center;
// }
.package-resources{
padding: 5px 36px;
margin-bottom: 10px;
......
<template>
<info-con title="销售信息:" class="sale-info-con">
<div class="item">
<label class="label">销售模式:</label>
<RadioGroup v-model="data.salesType">
<Radio :label="1" style="width:200px" :disabled="isDetail || isEdit || isDraft">普通</Radio>
<Radio :label="2" style="width:200px" :disabled="isDetail || isEdit || isDraft || packType">预售</Radio>
<!-- <Radio :label="3" style="width:200px" :disabled="isDetail || isEdit || isDraft || packType">拍卖</Radio> -->
<Radio :label="5" style="width: 200px" :disabled="isDetail || isEdit || isDraft ">免费领取</Radio>
</RadioGroup>
</div>
<div class="item" v-if="shopStatus != 4">
<label class="label">限购数量:</label>
<Input
v-model.number="data.purchaseLimit"
type="number"
:disabled="isDetail"
placeholder="请输入限购数量"
style="width: 400px"
/>
</div>
<div class="item" v-if="data.salesType==2">
<label class="label">预售价格:</label>
<Input v-model="data.originalPrice" :readonly='isDetail' type="number" style="width: 400px;">
</Input>
</div>
<div class="item" v-if="data.salesType==2">
<label class="label">预售时间:</label>
<Row class="time">
<Col>
<DatePicker type="date" :options="startOption" :readonly="isDetail" v-model="data.saleStartTime" placeholder="请选择开始时间" style="width: 200px"></DatePicker>
</Col>
<span></span>
<Col>
<DatePicker type="date" :options="endOption" :readonly="isDetail" v-model="data.saleEndTime" placeholder="请选择结束时间" style="width: 200px"></DatePicker>
</Col>
</Row>
</div>
<div class="item" v-if="data.salesType==2">
<label class="label">预计提货时间:</label>
<Row class="time">
<Col>
<DatePicker type="date" :options="drawStartOption" :readonly="isDetail" v-model="data.drawStartTime" placeholder="请选择开始时间" style="width: 200px"></DatePicker>
</Col>
<span></span>
<Col>
<DatePicker type="date" :options="drawEndOption" :readonly="isDetail" v-model="data.drawEndTime" placeholder="请选择结束时间" style="width: 200px"></DatePicker>
</Col>
</Row>
</div>
<div class="item" v-if="data.salesType==2">
<label class="label">预售定金:</label>
<RadioGroup v-model="data.depositType">
<Radio label="1" :disabled="isDetail" class="ivu-radio" style="width: 260px;">
<span>固定比例</span>
<Input v-model="data.fixedProportion" :disabled="isDetail" style="width: 100px"/>
<span>%</span>
</Radio>
<Radio label="2" :disabled="isDetail" class="ivu-radio" style="width: 260px">
<span>固定金额</span>
<Input v-model="data.fixedAmount" :disabled="isDetail" style="width: 100px"/>
<span></span>
</Radio>
</RadioGroup>
</div>
<div class="item" v-if="data.salesType==3">
<label class="label">起拍价:</label>
<Input v-model="data.startPrice" :readonly='isDetail' type="number" style="width: 400px;">
</Input>
</div>
<div class="item" v-if="data.salesType==3">
<label class="label">拍卖保证金:</label>
<Input v-model="data.buyerDeposit" :readonly='isDetail' type="number" style="width: 400px;">
</Input>
</div>
<div class="item" v-if="data.salesType==3">
<label class="label">出价最小增幅:</label>
<Input v-model="data.priceIncrease" :readonly='isDetail' type="number" style="width: 400px;">
</Input>
</div>
<div class="item" v-if="data.salesType==3">
<label class="label">竞拍结束时间:</label>
<DatePicker type="date" :options="buyEndOption" :readonly="isDetail" v-model="data.endTime" placeholder="请选择结束时间" style="width: 400px"></DatePicker>
</div>
<div class="item" v-if="data.salesType==3">
<label class="label">付款结束时间:</label>
可以延后
<Input v-model="data.delayPayTime" :readonly='isDetail' type="number" style="width: 150px;">
</Input>
天付款
</div>
<div class="item" v-if="data.salesType==1 ||data.salesType==5 ">
<label class="label">销售价格:</label>
<Input v-model="data.originalPrice" :readonly='isDetail' type="number" style="width: 400px;">
</Input>
</div>
<!-- <div class="item">
<div class="item" v-if="shopStatus == 1">
<label class="label">商品重量:</label>
<Input v-model="data.weight" :readonly='isDetail' type="number" style="width: 400px;">
</Input>
</div> -->
</div>
<div class="item">
<label class="label">NFT销售方式:</label>
<RadioGroup v-model="data.nftSalesType">
<Radio :label="1" style="width:200px" :disabled="isDetail || isEdit || isAgain">原商品销售</Radio>
<Radio :label="2" style="width:200px" :disabled="isDetail || isEdit || isAgain">使用权销售</Radio>
<Radio :label="1" style="width:200px" :disabled="isDetail || isEdit || isDraft || isAgain">原商品销售</Radio>
<Radio :label="2" style="width:200px" :disabled="isDetail || isEdit || isDraft || isAgain|| availableNumber != 1">使用权销售</Radio>
</RadioGroup>
</div>
<div class="item" v-if="data.nftSalesType==2">
<label class="label">拷贝数量:</label>
<Input v-model="data.stock" :readonly='isDetail || isEdit|| isAgain' style="width: 400px;">
<Input v-model="data.stock" :readonly='isDetail || isAgain' :maxlength="6" style="width: 400px;">
</Input>
</div>
<div class="item">
<label class="label">溯源哈希:</label>
<Input v-model="data.hash" :readonly='isDetail' style="width: 400px;" />
</div>
</info-con>
</template>
......@@ -29,7 +122,7 @@
import InfoCon from './info-con'
import FileUpload from '_c/file-upload'
import config from '@/config'
// import { deepCopy } from '@/utils/common'
import { deepCopy } from '@/utils/common'
import axios from 'axios'
const baseUrl =
process.env.NODE_ENV === 'development'
......@@ -40,11 +133,26 @@ export default {
data: {
type: Object,
default: { sku: [] },
commodityPass: 3,
commodityPass: '',
saleStartTime: '',
saleEndTime: '',
drawStartTime: '',
drawEndTime: '',
fixedProportion: '',
fixedAmount: '',
depositType: '',
price: '',
startPrice: '',
buyerDeposit: '',
priceIncrease: '',
delayPayTime: '',
endTime: '',
stock: '',
salesType: 1,
originalPrice: '',
// weight: '',
weight: '',
nftSalesType: '',
stock: ''
purchaseLimit:0
},
isDetail: {
type: Boolean,
......@@ -62,7 +170,12 @@ export default {
type: Boolean,
default: false
},
status: ''
isDraft: {
type: Boolean,
default: false
},
shopStatus: '',
availableNumber: ''
},
watch: {
......@@ -72,7 +185,7 @@ export default {
// this.propList = [{ outToken: '', valList: [{ val: '' }] }]
// }
// },
// status (val) {
// shopStatus (val) {
// // console.log('111', val)
// if (val == 3 || val == 2) {
// this.data.salesType = 1
......@@ -85,14 +198,46 @@ export default {
},
data () {
return {
propList: [{ outToken: '', valList: [{ val: '' }] }],
showTable: false,
columns: []
drawStartOption: {
// 指定开始限制时间
disabledDate: (date) => {
return date && date.valueOf() < Date.now() - 86400000
}
},
drawEndOption: {
// 指定终止日期
disabledDate: (date) => {
return date && date.valueOf() < Date.now() - 86400000
}
},
startOption: {
// 指定开始限制时间
disabledDate: (date) => {
return date && date.valueOf() < Date.now() - 86400000
}
},
endOption: {
// 指定终止日期
disabledDate: (date) => {
return date && date.valueOf() < Date.now() - 86400000
}
},
buyEndOption: {
// 指定终止日期
disabledDate: (date) => {
return date && date.valueOf() < Date.now() - 86400000
}
}
// rateList: [3, 4, 5, 6, 9, 10, 11, 13]
}
},
computed: {
platform () {
return this.$store.state.admin.type == 1 || this.$store.state.admin.type == 4
},
packType () {
return this.shopStatus == 3
}
},
mounted () {
......@@ -101,6 +246,11 @@ export default {
})
},
methods: {
// changeSalesType(val){
// this.$set(this.data,'salesType',val)
// this.data.salesType=val
// console.log(this.data)
// }
}
}
</script>
......
......@@ -5,19 +5,17 @@
<Input
placeholder="请填写商品名称"
v-model="data.name"
:readonly="isDetail || isEdit"
:readonly="isDetail || isEdit || isDraft|| isAgain"
:maxlength="30"
/>
</div>
<div class="item">
<label class="label">商品类型:</label>
<RadioGroup v-model="data.type">
<!-- <Radio label="1" :disabled="isDetail || isEdit || isAgain" class="ivu-radio">普通</Radio>
<Radio label="2" :disabled="isDetail || isEdit || isAgain" class="ivu-radio">预售</Radio>
<Radio label="3" :disabled="isDetail || isEdit || isAgain" class="ivu-radio">拍卖</Radio>
<Radio label="5" :disabled="isDetail || isEdit || isAgain" class="ivu-radio">打包</Radio> -->
<!-- <Radio label="6" :disabled="isDetail || isEdit || isAgain" class="ivu-radio">NFT</Radio> -->
<span style="font-size:15px;">NFT</span>
<RadioGroup v-model="data.type" @on-change="changeType" :readonly="isDetail || isEdit || isDraft|| isAgain">
<Radio label="1" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio">普通</Radio>
<Radio label="2" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio">虚拟(不支持提货)</Radio>
<!-- <Radio label="3" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio">打包</Radio> -->
<Radio label="4" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio">NFT</Radio>
</RadioGroup>
</div>
<div class="item">
......@@ -69,8 +67,8 @@
shape="circle"
size="small"
@click="addProp"
v-if="!isDetail"
>+ 添加属性值</Button
v-if="!isDetail "
>+ 添加属性值(非必填)</Button
>
</div>
</div>
......@@ -80,10 +78,25 @@
<Input
v-if="isDetail"
v-model="data.categoryId"
:readonly="isDetail"
:readonly="isDetail|| isEdit"
style="width:400px;"
/>
<Cascader v-else :data="categoryList" v-model="data.categoryId" @on-change="handleChange"></Cascader>
<Cascader v-else style="width:400px;" :disabled="isEdit" :data="categoryList" v-model="data.categoryId" @on-change="handleChange"></Cascader>
</div>
<!-- <div class="item">
<label class="label">应用NFT:</label>
<RadioGroup v-model="data.useNft">
<Radio label="0" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio"></Radio>
<Radio label="1" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio"></Radio>
</RadioGroup>
</div> -->
<!-- <div class="item">
<label class="label">正品认证:</label>
<RadioGroup v-model="data.type">
<Radio label="1" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio">申请</Radio>
<Radio label="2" :disabled="isDetail || isEdit || isDraft|| isAgain" class="ivu-radio">不申请</Radio>
</RadioGroup>
</div> -->
</info-con>
</template>
......@@ -96,10 +109,11 @@ export default {
default: {
name: '',
description: '',
prop: [{ name: '', val: '' }],
prop: [],
// rate: '',
// typeCode: '',
type: '',
useNft: '',
categoryId: []
}
},
......@@ -114,13 +128,32 @@ export default {
isAgain: {
type: Boolean,
default: false
}
},
isDraft: {
type: Boolean,
default: false
},
clearForm: Function
},
data () {
return {
categoryList: []
}
},
// watch: {
// 'data.type' (newVal, oldVal) {
// console.log('oldVal', oldVal)
// console.log('newVal', newVal)
// if (oldVal != newVal) {
// this.data = {
// description: '',
// prop: [],
// useNft: '',
// categoryId: []
// }
// }
// }
// },
components: {
InfoCon
},
......@@ -138,6 +171,11 @@ export default {
// this.text = selectedData.map(o => o.label).join(', ')
// console.log('value', value)
},
changeType () {
// console.log(this.$parent)
this.clearForm()
// this.$parent.clearForm()
},
getCategory () {
// 获取商品类目
this.api({
......@@ -187,7 +225,7 @@ export default {
align-items: center;
margin-bottom: 10px;
.ivu-radio{
width: 100px;
width: 200px;
}
}
.item .label {
......
<template>
<info-con title="图文描述:" class="decipt-info-con">
<div class="item">
<div class="item" v-show="shopStatus!=4">
<label class="label">商品图片:</label>
<div class="upload-con">
<file-upload
......@@ -15,7 +15,7 @@
<div class="tip" v-if="!isDetail">提示:最多可上传5张,建议尺寸375 * 365,大小不得超过6MB。</div>
</div>
</div>
<div class="item" v-show="!isDetail || !!data.video">
<div class="item" v-show="(!isDetail&&!isEdit && shopStatus!=4) || !!data.video">
<label class="label">商品视频:</label>
<div class="upload-con">
<file-upload
......@@ -29,7 +29,7 @@
:readonly="isDetail"
showWatch
/>
<div class="tip" v-if="!isDetail">提示:仅可上传一张,商品宣传视频,用于详情页展示,建议尺寸375 * 365,大小不得超过50MB。(非必传)</div>
<div class="tip" v-if="!isDetail">提示:仅可上传一张,商品宣传视频,用于详情页展示,建议尺寸375 * 365,大小不得超过50MB(非必传)。</div>
</div>
</div>
<div class="item">
......@@ -48,23 +48,6 @@
<!-- {{data.thumbList}} -->
</div>
</div>
<div class="item" v-show="!isDetail || !!data.nftFile">
<label class="label">NFT附件:</label>
<div class="upload-con">
<file-upload
type="NFT"
:width="150"
:iconSize="26"
:maxNum="1"
:maxSize="100"
v-model="data.nftEnclosureList"
:defaultList="data.defaultNftEnclosureList"
:readonly="isDetail"
showWatch
/>
<div class="tip" v-if="!isDetail">提示:仅可上传一份附件,大小不得超过100MB。(非必传)</div>
</div>
</div>
<div class="item">
<label class="label">详情描述:</label>
<div class="editor-con">
......@@ -125,7 +108,6 @@ export default {
default: {
video: '',
videoList: [],
nftFile: '',
videoThumb: '',
videoThumbList: [],
thumb: '',
......@@ -135,16 +117,18 @@ export default {
defaultDetailPicture: [],
defaultVideoList: [],
defaultVideoThumbList: [],
defaultThumbList: [],
nftEnclosureList: [],
defaultNftEnclosureList: []
defaultThumbList: []
}
},
isDetail: {
type: Boolean,
default: false
},
status: ''
isEdit: {
type: Boolean,
default: false
},
shopStatus: ''
},
computed: {
editor () {
......
......@@ -13,155 +13,29 @@
:isDetail="isDetail"
:isEdit="isEdit"
:isAgain="isAgain"
/>
<decipt-info
:data="form.deciptInfo"
:isDetail="isDetail"
:status="status"
:isDraft="isDraft"
:clearForm="clearForm"
/>
<sale-info
:data="form.saleInfo"
:isDetail="isDetail"
:isEdit="isEdit"
:isAgain="isAgain"
:isSelf="isSelf"
:isDraft="isDraft"
:status="status"
/>
<info-con
title="资源信息"
class="base-info-con"
v-if="form.baseInfo.type == 5"
>
<div class="series-info">
<label class="label">打包价格:</label>
<Input
v-model="form.packageDTO.price"
:disabled="isDetail"
placeholder="请输入打包价格"
style="width: 400px"
/>
</div>
<div class="package-resources">
<label class="label">打包资源:</label>
<div class="property-con">
<div
class="property-item"
v-for="(item, index) of form.packageDTO.resource"
:key="'prop-item-' + index"
>
<AutoComplete
v-model="item.name"
@on-search="handleSearch($event, index)"
placeholder="请输入资源编号或名称"
:disabled="isDetail"
style="width: 215px"
>
<Option
v-for="(item, index) in item.integralMerchantNameList"
:value="item.name"
:key="'state-option-' + index"
>{{ item.name }}</Option
>
</AutoComplete>
<Select
placeholder="请选择资源规格"
class="search-input"
v-model="item.skuId"
:disabled="isDetail"
style="width: 215px; margin: 0 20px"
>
<Option
v-for="(itemb, idx) of item.specificationsList"
:value="itemb.skuId"
:key="itemb.skuId"
@click.native="handleSpecifications(idx, index)"
>{{ itemb.name }}</Option
>
</Select>
<Input
class="prop-val"
placeholder="请设置资源数量"
v-model="item.number"
:disabled="isDetail"
@on-blur="onBlur(index, item)"
:maxlength="30"
style="width: 215px"
/>
<span v-if="item.actualNumber && item.actualNumber != 0"
>资源总数:{{ item.actualNumber }}</span
>
<Icon
class="del-con"
type="md-close-circle"
color="#ed4014"
v-if="!isDetail"
:size="20"
@click="delAge(index)"
:isSelf="isSelf"
:shopStatus="status"
v-if="form.baseInfo.type != 6 && form.baseInfo.type != 5"
/>
</div>
<div class="add-btn">
<Button type="info" @click="addAge" v-if="!isDetail"
>+ 添加</Button
>
</div>
</div>
</div>
<div class="series-info">
<label class="label">库存:</label>
<Input
v-model="form.packageDTO.stock"
:disabled="isDetail"
placeholder="请输入库存"
style="width: 400px"
@on-blur="stockBlur(form.packageDTO.stock)"
<decipt-info
:data="form.deciptInfo"
:isDetail="isDetail"
:isEdit="isEdit"
:isAgain="isAgain"
:isDraft="isDraft"
:shopStatus="status"
/>
</div>
</info-con>
<!-- <info-con title="规格信息" class="base-info-con" v-if="form.baseInfo.type==6">
<div class="series-info">
<label class="label">商品价格:</label>
<Input v-model="form.nftdto.price" :readonly="isDetail" placeholder="请输入商品价格" style="width: 400px" />
</div>
<div class="series-info">
<label class="label">商品通证:</label>
<RadioGroup v-model="form.nftdto.tzType" @on-change="changeTzType">
<Radio label="1" :disabled="isDetail||isEdit||isAgain" style="width:200px;">内部发行</Radio>
<Radio label="2" :disabled="isDetail||isEdit||isAgain" style="width:200px;">外部绑定</Radio>
</RadioGroup>
</div>
<div class="series-info" v-if="form.nftdto.tzType==1">
<label class="label">NFT类型:</label>
<RadioGroup v-model="form.nftdto.type" @on-change="changeType">
<Radio label="1" :disabled="isDetail||isEdit||isAgain" style="width:200px;">单个,不可拷贝</Radio>
<Radio label="2" :disabled="isDetail||isEdit||isAgain" style="width:200px;">可拷贝</Radio>
</RadioGroup>
</div>
<div class="series-info" v-if="form.nftdto.type==2">
<label class="label">发行数量:</label>
<Input v-model="form.nftdto.number" :readonly="isDetail||isEdit||isAgain" placeholder="请输入发行数量,正整数" style="width: 400px" />
</div>
<div class="series-info" v-if="form.nftdto.tzType==2">
<label class="label">绑定NFT:</label>
<Input v-model="form.nftdto.tokenId" v-if="isDetail||isEdit||isAgain" :readonly="isDetail||isEdit||isAgain" style="width: 400px" />
<Select
v-else
placeholder="请选择NFT TOKENID"
transfer
v-model="form.nftdto.tokenId"
style="width: 200px"
>
<Option
:value="item.labelName"
v-for="(item, index) of nftList"
:key="`rate-option-${index}`"
@click.native="handleNFT(item)"
>{{ item.labelName }}</Option
>
</Select>
</div>
</info-con> -->
<info-con title="销售信息:" class="base-info-con">
<info-con title="售后信息:" class="base-info-con">
<template v-if="this.form.saleInfo.salesType !== 5">
<div
class="series-info"
v-if="
......@@ -172,148 +46,33 @@
<label class="label">是否允许延后提货:</label>
<i-switch
v-model="form.delayDelivery"
:disabled="delayDeliveryDisabled || isDetail"
:disabled="delayDeliveryDisabled || isDetail || isEdit|| isAgain ||isDraft"
/>
</div>
<div class="series-info">
<div class="series-info" v-if="form.baseInfo.type != 4">
<label class="label">退换货类型:</label>
<RadioGroup v-model="form.returnType">
<Radio label="0" :disabled="isDetail" class="ivu-radio"
<RadioGroup v-model="backType">
<Radio label="1" :disabled="isDetail || isEdit|| isAgain||isDraft" class="ivu-radio"
>不支持</Radio
>
<Radio label="1" :disabled="isDetail" class="ivu-radio"
<Radio label="2" :disabled="isDetail || isEdit|| isAgain||isDraft" class="ivu-radio"
>七天无理由退货</Radio
>
<Radio label="2" :disabled="isDetail" class="ivu-radio">
<Radio label="3" :disabled="isDetail || isEdit|| isAgain||isDraft" class="ivu-radio">
自定义
<Input
v-model="form.returnReason"
:disabled="isDetail"
type="textarea"
placeholder="请输入退货缘由"
style="width: 200px"
/>
</Radio>
</RadioGroup>
</div>
<div class="series-time" v-if="form.baseInfo.type == 2">
<label class="label">预售时间:</label>
<Row class="time">
<Col>
<DatePicker
type="date"
:options="startOption"
:readonly="isDetail"
v-model="form.saleStartTime"
placeholder="请选择开始时间"
style="width: 200px"
></DatePicker>
</Col>
<span></span>
<Col>
<DatePicker
type="date"
:options="endOption"
:readonly="isDetail"
v-model="form.saleEndTime"
placeholder="请选择结束时间"
style="width: 200px"
></DatePicker>
</Col>
</Row>
</div>
<div class="series-time" v-if="form.baseInfo.type == 2">
<label class="label">预计提货时间:</label>
<Row class="time">
<Col>
<DatePicker
type="date"
:options="drawStartOption"
:readonly="isDetail"
v-model="form.drawStartTime"
placeholder="请选择开始时间"
style="width: 200px"
></DatePicker>
</Col>
<span></span>
<Col>
<DatePicker
type="date"
:options="drawEndOption"
:readonly="isDetail"
v-model="form.drawEndTime"
placeholder="请选择结束时间"
style="width: 200px"
></DatePicker>
</Col>
</Row>
</div>
<div class="series-time" v-if="form.baseInfo.type == 2">
<label class="label">首付比例:</label>
<RadioGroup v-model="form.depositType">
<Radio
label="1"
:disabled="isDetail"
class="ivu-radio"
style="width: 260px"
>
<span>固定比例</span>
<Input
v-model="fixedProportion"
:disabled="isDetail"
style="width: 100px"
/>
<span>%</span>
<!-- </Input> -->
</Radio>
<Radio
label="2"
:disabled="isDetail"
class="ivu-radio"
style="width: 260px"
>
<span>固定金额</span>
<Input
v-model="fixedAmount"
:disabled="isDetail"
style="width: 100px"
v-model="customDays"
type="number"
:max="15"
:disabled="isDetail || isEdit|| isAgain||isDraft"
style="width: 80px"
/>
<span></span>
<!-- </Input> -->
无理由退款
</Radio>
</RadioGroup>
</div>
<div class="series-time" v-if="form.baseInfo.type == 3">
<label class="label">拍卖保证金:</label>
<Input
v-model="form.buyerDeposit"
:readonly="isDetail"
type="number"
style="width: 100px"
>
</Input>
</div>
<div class="series-time" v-if="form.baseInfo.type == 3">
<label class="label">出价最小增幅:</label>
<Input
v-model="form.priceIncrease"
:readonly="isDetail"
type="number"
style="width: 100px"
>
</Input>
</div>
<div class="series-time" v-if="form.baseInfo.type == 3">
<label class="label">结束时间:</label>
<DatePicker
type="date"
:options="buyEndOption"
:readonly="isDetail"
v-model="form.endTime"
placeholder="请选择结束时间"
style="width: 200px"
></DatePicker>
</div>
</template>
<div class="series-info">
<label class="label">商品备注:</label>
<Input
......@@ -333,17 +92,6 @@
<!-- <Input v-model="form.pnum" type="number" placeholder="所需积分" style="width: 200px" />-->
<!-- </div>-->
</info-con>
<info-con title="溯源信息" class="base-info-con">
<div class="series-info">
<label class="label">溯源编号:</label>
<Input
v-model="form.traceabilityNumber"
:readonly="isDetail"
placeholder="请输入溯源系统的商品溯源编号(非必填)"
style="width: 400px"
/>
</div>
</info-con>
<div class="submit-bottom">
<div class="submit-con">
<Button
......@@ -428,35 +176,55 @@ export default {
brandId: "",
brandName: "",
goodsId: "",
// templateId: '',
baseInfo: {
name: "", // 商品名称
description: "", // 商品描述
prop: [{ name: "", val: "" }], // 商品属性
// prop: [{ name: '', val: '' }], // 商品属性
prop: [],
categoryId: [], // 类目选择
type: "6", // 商品类型
type: "1", // 商品类型
useNft: "0",
},
saleInfo: {
sku: [],
imgObj: {},
commodityPass: 1,
number: "", // 发行数量:只有商户选择“可拷贝”时,才会出现
price: "", // 商品价格
type: "", // NFT类型(1.单个,不可考贝 2.可拷贝)
tzType: "", // 1.内部发行 2.外部绑定
tokenId: "", // 绑定的外部通证id
salesType: 4, // 销售模式
commodityPass: 0,
saleStartTime: "",
saleEndTime: "",
drawStartTime: "",
drawEndTime: "",
fixedProportion: "",
fixedAmount: "",
depositType: "",
resource: [
{
integralMerchantNameList: [],
goodsId: "",
skuId: "",
number: "",
specificationsList: [],
actualNumber: "",
},
], // 打包资源
stock: "",
salesType: 1,
name: "",
outToken: "",
shopPrice: "",
preSalePrice: "",
hash: "",
difficulty: 3,
isHide: false,
// stock: 0,
blindBoxRule: "",
purchaseLimit:0
// statu:this.status
},
deciptInfo: {
video: "",
videoList: [],
nftFile: "",
nftEnclosureList: [],
videoThumb: "",
thumb: "",
thumbList: [],
......@@ -465,21 +233,11 @@ export default {
defaultDetailPicture: [],
defaultVideoList: [],
defaultThumbList: [],
defaultNftEnclosureList: [],
// statu:this.status
},
returnType: "0", // 退货类型
returnType: "", // 退货类型
returnReason: "", // 退货理由
note: "", // 商品备注
buyerDeposit: "", // 买家保证金
priceIncrease: "", // 出价最小增幅
endTime: "", // 结束时间
deposit: "", // 首付比例
depositType: "", // 首付比例类型
drawStartTime: "", // 预计提货开始时间
drawEndTime: "", // 预计提货结束时间
saleStartTime: "", // 预售开始时间
saleEndTime: "", // 预售结束时间
stock: "", // 积分库存
pnum: "", // 积分数量
traceabilityNumber: "", // 溯源编号
......@@ -498,190 +256,93 @@ export default {
price: "", // 打包价格
stock: "", // 库存
},
nftdto: {
number: "", // 发行数量:只有商户选择“可拷贝”时,才会出现
price: "", // 商品价格
type: "", // NFT类型(1.单个,不可考贝 2.可拷贝)
tzType: "", // 1.内部发行 2.外部绑定
tokenId: "", // 绑定的外部通证id
},
},
skuNumber: "",
loading: true,
expressList: [],
profitList: [],
integralMerchantNameList: [],
specificationsList: [],
// specificationsList: [],
idx: "",
fixedProportion: "",
fixedAmount: "",
// fixedProportion: '',
// fixedAmount: '',
depositList: [3, 4, 5, 6, 9, 10, 11, 13],
nftList: [],
submitLoading: false,
startOption: {
// 指定开始限制时间
disabledDate: (date) => {
return date && date.valueOf() < Date.now() - 86400000;
},
},
endOption: {
// 指定终止日期
disabledDate: (date) => {
return date && date.valueOf() < Date.now() - 86400000;
},
},
drawStartOption: {
// 指定开始限制时间
disabledDate: (date) => {
return date && date.valueOf() < Date.now() - 86400000;
},
},
drawEndOption: {
// 指定终止日期
disabledDate: (date) => {
return date && date.valueOf() < Date.now() - 86400000;
},
},
draftLoading: false,
backType: "1",
customDays: "",
buyEndOption: {
// 指定终止日期
disabledDate: (date) => {
return date && date.valueOf() < Date.now() - 86400000;
},
},
draftLoading: false,
};
},
methods: {
...mapMutations(["closeTag"]),
addAge() {
this.form.packageDTO.resource.push({
clearForm() {
// Object.assign(this.$data, this.$options.data())
this.form.baseInfo.description = "";
this.form.baseInfo.prop = [];
this.form.baseInfo.categoryId = [];
this.form.saleInfo.sku = [];
this.form.saleInfo.imgObj = {};
this.form.saleInfo.commodityPass = 0;
this.form.saleInfo.saleStartTime = "";
this.form.saleInfo.saleEndTime = "";
this.form.saleInfo.drawStartTime = "";
this.form.saleInfo.drawEndTime = "";
this.form.saleInfo.fixedProportion = "";
this.form.saleInfo.fixedAmount = "";
this.form.saleInfo.depositType = "";
this.form.saleInfo.resource = [
{
integralMerchantNameList: [],
goodsId: "",
skuId: "",
number: "",
specificationsList: [],
actualNumber: "",
});
},
changeTzType() {
this.form.nftdto.type = "";
this.form.nftdto.number = "";
this.form.nftdto.tokenId = "";
},
changeType() {
this.form.nftdto.number = "";
},
delAge(index) {
this.form.packageDTO.resource.splice(index, 1);
},
handleNFT(val) {
console.log(val);
this.form.nftdto.number = val.availableNumber;
},
handleSearch(goodsInfo, index) {
if (!goodsInfo) {
return this.$Message.warning("请先输入资源编号以便查询!");
}
this.api({
apiName: "spugetbyvague",
postdata: goodsInfo,
success: (res) => {
this.form.packageDTO.resource[index].integralMerchantNameList =
res.data;
if (
this.form.packageDTO.resource[index].integralMerchantNameList
.length === 1
) {
let goodsId =
this.form.packageDTO.resource[index].integralMerchantNameList[0]
.goodsId;
this.api({
apiName: "skugetbygoodsId",
postdata: goodsId,
success: (res) => {
let arr = [];
let list =
this.form.packageDTO.resource[index].specificationsList;
if (list && list.length > 0) {
for (let item of res.data) {
if (
list.find((x) => {
return x.skuId === item.skuId;
})
) {
item.stock = list.find((x) => {
return x.skuId === item.skuId;
}).stock;
}
arr.push(item);
}
} else {
arr = res.data;
}
this.form.packageDTO.resource[index].specificationsList = arr;
},
});
}
},
});
},
handleSpecifications(idx, index) {
this.idx = idx;
this.form.packageDTO.resource[index].number = "";
for (var i = 0; i < this.form.packageDTO.resource.length - 1; i++) {
for (var j = i + 1; j < this.form.packageDTO.resource.length; j++) {
if (
this.form.packageDTO.resource[i].skuId ===
this.form.packageDTO.resource[j].skuId
) {
let title = "规格信息不能重复!";
this.form.packageDTO.resource[index].skuId = "";
return this.$Notice.error({ title });
}
}
}
},
onBlur(index, val) {
for (let i = 0, len = val.specificationsList.length; i < len; i++) {
if (val.specificationsList[i].skuId === val.skuId) {
this.idx = i;
break;
}
}
let idx = this.idx;
this.form.packageDTO.resource[index].actualNumber =
this.form.packageDTO.resource[index].specificationsList[idx].stock;
this.$set(
this.form.packageDTO.resource,
index,
this.form.packageDTO.resource[index]
);
let stockNumber = JSON.parse(val.number) * this.form.packageDTO.stock;
if (stockNumber > this.form.packageDTO.resource[index].actualNumber) {
this.form.packageDTO.resource[index].number = "";
return this.$Notice.warning({
title: `库存*填写的资源量不能超过总资源数量`,
});
}
];
this.form.saleInfo.stock = "";
this.form.saleInfo.salesType = 1;
this.form.saleInfo.name = "";
this.form.saleInfo.outToken = "";
this.form.saleInfo.shopPrice = "";
this.form.saleInfo.preSalePrice = "";
this.form.saleInfo.hash = "";
this.form.deciptInfo.video = "";
this.form.deciptInfo.videoList = [];
this.form.deciptInfo.videoThumb = "";
this.form.deciptInfo.thumb = "";
this.form.deciptInfo.thumbList = [];
this.form.deciptInfo.detailPictures = [];
this.form.deciptInfo.detailDescribe = "";
this.form.deciptInfo.defaultDetailPicture = [];
this.form.deciptInfo.defaultVideoList = [];
this.form.deciptInfo.defaultThumbList = [];
this.backType = "1";
this.customDays = "";
this.form.note = "";
this.form.stock = "";
this.form.pnum = "";
this.form.traceabilityNumber = "";
this.form.delayDelivery = false;
this.form.packageDTO.resource = [
{
integralMerchantNameList: [],
goodsId: "",
skuId: "",
number: "",
specificationsList: [],
actualNumber: "",
},
stockBlur(val) {
let skuNumber = this.form.packageDTO.resource;
skuNumber.forEach((item, index) => {
let number = item.number * val;
let n = NaN;
for (let i = 0, len = item.specificationsList.length; i < len; i++) {
if (item.specificationsList[i].skuId === item.skuId) {
n = i;
break;
}
}
if (number > item.specificationsList[n].stock) {
this.form.packageDTO.resource[index].number = "";
return this.$Notice.warning({
title: `库存 * 填写的资源量不能超过总资源数量`,
});
}
});
];
this.form.packageDTO.price = "";
this.form.packageDTO.stock = "";
},
requestOptionData() {
// 获取快递模板
......@@ -692,16 +353,16 @@ export default {
},
});
},
getNftList() {
// 获取外部NFT
this.api({
apiName: "externnftlist",
success: (res) => {
// console.log('333', this.nftList)
this.nftList = res.data;
},
});
},
// getNftList () {
// // 获取外部NFT
// this.api({
// apiName: 'externnftlist',
// success: (res) => {
// // console.log('333', this.nftList)
// this.nftList = res.data
// }
// })
// },
getDelayDelivery() {
if (!this.isDetail) {
this.api({
......@@ -722,83 +383,177 @@ export default {
});
}
},
requestGoodDetail(goodsId) {
requestGoodDetail(id) {
this.loading = true;
this.api({
apiName: "getGoodDetail",
postdata: { goodsId },
postdata: { id },
success: (res) => {
let {
brandId,
brandName,
// templateId,
name,
description,
detail,
categoryIds,
categoryName,
goodsId,
type,
prop,
returnReason,
returnType,
note,
salesType,
delayDelivery,
imgList,
nftFile,
skus,
commodityPass,
thumb,
traceabilityNumber,
imgList,
video,
blindBoxPrice,
difficulty,
goodsNftVO,
blindBoxRule,
videoThumb,
thumb,
detail,
type,
note,
returnType,
traceabilityNumber,
delayDelivery,
returnReason,
categoryName,
categoryIds,
preSaleVO,
auctionVO,
commodityPass,
goodsPackageVO,
goodsNftVO,
useNft,
salesType,
purchaseLimit,
} = res.data;
let form = {
goodsId: goodsId,
blindBoxPrice,
difficulty,
baseInfo: {
name: name, // 商品名称
description: description, // 商品描述
prop: JSON.parse(prop), // 商品属性
this.form.brandId = brandId;
this.form.blindBoxPrice = blindBoxPrice;
this.form.difficulty = difficulty;
this.form.brandName = brandName;
// this.form.templateId = templateId
this.form.note = note;
// this.form.returnType = returnType.toString()
if (returnType == 0) {
this.backType = "1";
} else if (returnType == 7) {
this.backType = "2";
} else {
this.backType = "3";
this.customDays = returnType;
// form.returnType = this.customDays
}
this.form.returnReason = returnReason;
this.form.traceabilityNumber = traceabilityNumber;
if (delayDelivery == 0) {
this.form.delayDelivery = false;
} else {
this.form.delayDelivery = true;
}
if (auctionVO) {
this.form.saleInfo.buyerDeposit = auctionVO.buyerDeposit;
this.form.saleInfo.startPrice = auctionVO.startPrice;
this.form.saleInfo.priceIncrease = auctionVO.priceIncrease;
this.form.saleInfo.delayPayTime = auctionVO.delayPayTime;
this.form.saleInfo.endTime = auctionVO.endTime
? formatTime(auctionVO.endTime)
: "";
// this.form.saleInfo.name = auctionVO.name
}
this.form.baseInfo = {
name,
description,
prop: JSON.parse(prop),
type: type.toString(),
categoryId:
this.isDraft || this.isEdit
? JSON.parse(categoryIds)
: categoryName, // 类目选择
type: type, // 商品类型
},
deciptInfo: {
nftFile: nftFile || "",
nftEnclosureList: nftFile ? [nftFile] : [],
video: video || "",
videoList: video ? [video] : [],
thumb,
thumbList: thumb ? [thumb] : "",
detailPictures: imgList ? JSON.parse(imgList) : [],
detailDescribe: detail,
defaultDetailPicture: imgList ? JSON.parse(imgList) : [],
defaultVideoList: video ? [video] : [],
defaultThumbList: [thumb],
defaultNftEnclosureList: nftFile ? [nftFile] : [],
},
returnType: returnType + "", // 退货类型
returnReason: returnReason, // 退货理由
note: note, // 商品备注
delayDelivery: !!delayDelivery,
traceabilityNumber: traceabilityNumber,
: categoryName,
useNft: useNft.toString(),
};
let saleInfo = {
...goodsNftVO,
salesType,
sku: [],
blindBoxRule,
let newSku = [];
skus.forEach((item) => {
let { image, propertyList } = item;
let upload = {
imageList: [image],
defaultImgList: [image],
};
let prop = {};
propertyList.forEach((pItem) => {
prop[pItem.propKey] = pItem.propVal;
});
let obj = { ...item, ...prop, upload };
if (item.outToken) {
let str = JSON.parse(item.outToken);
str.disabled = true;
obj.outToken = JSON.stringify(str);
}
newSku.push(obj);
this.form.saleInfo.name = item.name;
this.form.saleInfo.id = item.commodityPassId;
this.form.saleInfo.outStock = item.stock;
});
this.form.saleInfo.sku = newSku;
this.form.saleInfo.purchaseLimit=purchaseLimit
this.form.saleInfo.commodityPass = commodityPass;
this.form.saleInfo.salesType = salesType;
this.form.saleInfo = { ...goodsNftVO, ...this.form.saleInfo };
this.form.saleInfo.blindBoxRule = blindBoxRule;
if (this.form.baseInfo.type == 4) {
if (
this.form.saleInfo.salesType == 1 ||
this.form.saleInfo.salesType == 5
) {
this.form.saleInfo.shopPrice = skus[0].originalPrice;
} else if (this.form.saleInfo.salesType == 2) {
this.form.saleInfo.preSalePrice = skus[0].originalPrice;
}
}
if (
this.form.baseInfo.type == 4 ||
this.form.saleInfo.salesType == 3
) {
this.form.saleInfo.hash = this.form.saleInfo.sku[0].hash;
}
this.form.deciptInfo = {
video,
videoList: [video],
videoThumb,
thumb,
thumbList: thumb ? [thumb] : [],
detailPictures: JSON.parse(imgList),
detailDescribe: detail,
if (salesType === 4) {
saleInfo.commodityPass = commodityPass || 1;
saleInfo.price = blindBoxPrice || 0;
saleInfo.difficulty = difficulty || 1;
defaultDetailPicture: JSON.parse(imgList),
defaultVideoList: [video],
defaultThumbList: thumb ? [thumb] : [],
};
if (!video) {
this.form.deciptInfo.video = "";
this.form.deciptInfo.defaultVideoList = [];
}
if (salesType == 2) {
this.form.saleInfo.depositType = preSaleVO.depositType.toString();
if (this.form.saleInfo.depositType == 1) {
this.form.saleInfo.fixedProportion = preSaleVO.deposit;
} else if (this.form.saleInfo.depositType == 2) {
this.form.saleInfo.fixedAmount = preSaleVO.deposit;
}
// this.form.deposit = preSaleVO.deposit
this.form.saleInfo.drawEndTime = preSaleVO.drawEndTime
? formatTime(preSaleVO.drawEndTime)
: "";
this.form.saleInfo.drawStartTime = preSaleVO.drawStartTime
? formatTime(preSaleVO.drawStartTime)
: "";
this.form.saleInfo.saleEndTime = preSaleVO.saleEndTime
? formatTime(preSaleVO.saleEndTime)
: "";
this.form.saleInfo.saleStartTime = preSaleVO.saleStartTime
? formatTime(preSaleVO.saleStartTime)
: "";
}
if (salesType == 4) {
this.form.saleInfo.commodityPass = commodityPass || 1;
this.form.saleInfo.price = blindBoxPrice || 0;
this.form.saleInfo.difficulty = difficulty || 1;
let sku = [];
for (let item of skus) {
let obj = {
...item,
......@@ -809,18 +564,27 @@ export default {
defaultImgList: [item.image],
},
};
saleInfo.sku.push(obj);
sku.push(obj);
}
this.form.saleInfo.sku = sku;
}
// if (salesType === 1) {
// saleInfo.stock = 0
// if (skus && skus.length>0) {
// saleInfo.stock = skus[0].stock
// }
console.log(this.form)
if (goodsPackageVO) {
goodsPackageVO.resource.forEach((item, index) => {
item.name = item.goodsName;
let stock = item.sku.number + item.number * goodsPackageVO.stock;
item.specificationsList = [
{ name: item.sku.name, skuId: item.sku.skuId, stock: stock },
];
item.skuId = item.sku.skuId;
});
this.form.packageDTO = goodsPackageVO;
}
// if (goodsNftVO) {
// goodsNftVO.type = goodsNftVO.type.toString()
// goodsNftVO.tzType = goodsNftVO.tzType.toString()
// // this.form.nftdto = goodsNftVO
// }
form.saleInfo = saleInfo;
this.form = form;
},
complete: () => {
this.loading = false;
......@@ -843,430 +607,225 @@ export default {
this.loading = false;
}
},
// checkForm() {
// let errMsg = "";
// let form = {
// auctionDTO: {},
// pointsExchangeDTO: {},
// preSaleDTO: {},
// skuList: [
// {
// coinName: "",
// originalPrice: "",
// nftSalesType: "",
// propertyList: [
// {
// propKey: "",
// propVal: "",
// },
// ],
// republish: "",
// skuId: "",
// stock: "",
// },
// ],
// packageDTO: {},
// nftdto: {},
// };
// let {
// goodsId,
// // templateId,
// baseInfo,
// saleInfo,
// deciptInfo,
checkForm() {
let errMsg = "";
let form = {
auctionDTO: {},
pointsExchangeDTO: {},
preSaleDTO: {},
skuList: [
{
coinName: "",
originalPrice: "",
propertyList: [
{
propKey: "",
propVal: "",
},
],
republish: "",
skuId: "",
stock: "",
skuName: "",
},
],
packageDTO: {},
// nftdto: {}
};
let {
goodsId,
// templateId,
baseInfo,
saleInfo,
deciptInfo,
// returnType,
// returnReason,
// note,
// deposit,
// depositType,
// buyerDeposit,
// priceIncrease,
// drawStartTime,
// drawEndTime,
// saleStartTime,
// saleEndTime,
// endTime,
// stock,
// pnum,
// traceabilityNumber,
// delayDelivery,
note,
deposit,
pnum,
traceabilityNumber,
delayDelivery,
// nftdto,
// // packagePrice
// packageDTO,
// } = this.form;
// form.goodsId = goodsId;
// if (!baseInfo) {
// return { errMsg: "请完善基本信息!" };
// }
// if (!baseInfo.name) {
// return { errMsg: "请填写 基本信息 - 商品名称!" };
// }
// if (!baseInfo.type) {
// return { errMsg: "请填写 基本信息 - 商品类型!" };
// }
// if (!baseInfo.description) {
// return { errMsg: "请填写 基本信息 - 商品描述!" };
// }
// // if (
// // (!baseInfo.prop ||
// // baseInfo.prop.length === 0 ||
// // !baseInfo.prop[0].name ||
// // !baseInfo.prop[0].val)
// // ) {
// // return { errMsg: '请填写 基本信息 - 商品属性!' }
// // }
// if (!baseInfo.categoryId || baseInfo.categoryId.length === 0) {
// return { errMsg: "请填写 基本信息 - 类目选择!" };
// }
// form = { ...form, ...baseInfo };
// // 销售信息
// if (baseInfo.type != 6 && baseInfo.type != 5) {
// if (!saleInfo.sku || saleInfo.sku.length === 0) {
// return { errMsg: "请完善规格信息!" };
// }
// let skuIndex = 0;
// saleInfo.sku.forEach((item) => {
// // console.log('item', item)
// if (!item.originalPrice && item.originalPrice != 0) {
// errMsg = "请填写 规格信息 - 价格!";
// }
// if (!item.stock) {
// errMsg = "请填写 规格信息 - 库存!";
// }
// if (this.isAdd && saleInfo.commodityPass == 1 && !item.coinName) {
// errMsg = "请填写 规格信息 - Token名称!";
// }
// if (!item.weight) {
// errMsg = "请填写 规格信息 - 重量!";
// }
// if (
// item.weight == 0 ||
// (item.weight && item.weight < 0) ||
// item.weight > 9999
// ) {
// errMsg = "规格信息 - 重量 格式不正确!";
// }
// item.weight = parseFloat(item.weight);
// if (!/^[0-9]+(.[0-9]{1,2})?$/.test(item.weight)) {
// errMsg = "规格信息 - 重量 最多至小数点后两位!";
// }
// // console.log('coinName', item.coinName)
// if (
// this.isAdd &&
// saleInfo.commodityPass == 1 &&
// !/^[A-Z0-9]{2,10}$/.test(item.coinName)
// ) {
// errMsg = "规格信息 - Token名称 格式不正确!";
// }
// if (item.originalPrice <= 0 || item.originalPrice > 999999) {
// errMsg = "规格信息 - 价格 格式不正确!";
// }
// item.originalPrice = parseFloat(item.originalPrice);
// if (!/^[0-9]+(.[0-9]{1,2})?$/.test(item.originalPrice)) {
// errMsg = "规格信息 - 价格 最多至小数点后两位!";
// }
// if (
// item.stock < 0 ||
// !/^\d+$/.test(item.stock) ||
// item.stock > 99999999
// ) {
// errMsg = "规格信息 - 库存 格式不正确!";
// }
// if (
// item.upload &&
// item.upload.imageList &&
// item.upload.imageList.length !== 0
// ) {
// saleInfo.sku[skuIndex].image = item.upload.imageList[0];
// }
// skuIndex++;
// });
// if (errMsg) {
// return { errMsg };
// }
// packagePrice
packageDTO,
} = this.form;
if(baseInfo.type==4){
form.purchaseLimit=1
}else{
form.purchaseLimit=saleInfo.purchaseLimit
}
// form.skuList = saleInfo.sku;
// form.commodityPass = saleInfo.commodityPass;
if (this.form.goodsId) {
form.goodsId = this.form.goodsId;
}
if (!baseInfo) {
return { errMsg: "请完善基本信息!" };
}
if (!baseInfo.name) {
return { errMsg: "请填写 基本信息 - 商品名称!" };
}
if (!baseInfo.type) {
return { errMsg: "请填写 基本信息 - 商品类型!" };
}
if (!baseInfo.description) {
return { errMsg: "请填写 基本信息 - 商品描述!" };
}
// if (form.commodityPass == 1) {
// form.skuList = form.skuList.map((item) => {
// let { coinName, coinNamePrefix, ...other } = item;
// return { coinName: coinNamePrefix + coinName, ...other };
// });
// }
// if (form.commodityPass == 2 && !this.isEdit) {
// form.skuList.forEach((item) => {
// let name = JSON.parse(item.name);
// item.commodityPassId = name.commodityPassId;
// item.coinName = `${item.coinNamePrefix}${name.labelName}`;
// });
// }
// }
// if (baseInfo.type == 6 && saleInfo.sku.length != 0) {
// // console.log(11111, saleInfo.sku)
// form.skuList = saleInfo.sku;
// }
// // form.skuList = skuList
// // console.log('form.skuList', form.skuList)
// // 图文信息
// if (!deciptInfo) {
// return { errMsg: "请完善图文描述!" };
// }
// if (
// !deciptInfo.detailPictures ||
// deciptInfo.detailPictures.length === 0
// ) {
// return { errMsg: "请上传 图文描述 - 商品图片!" };
// }
// // if (!deciptInfo.videoList || deciptInfo.videoList.length === 0) {
// // return { errMsg: '请上传 图文描述 - 商品视频!' }
// // }
// if (!deciptInfo.thumbList || deciptInfo.thumbList.length === 0) {
// return { errMsg: "请上传 图文描述 - 缩略图!" };
// }
// if (deciptInfo.detailDescribe.length > 18000) {
// return { errMsg: "图文描述 - 详情描述 内容长度过长!" };
// }
// if (deciptInfo.detailDescribe.length == 0) {
// return { errMsg: "图文描述 - 请输入详情描述!" };
// }
// // form = { ...form, ...deciptInfo }
// form.thumb = deciptInfo.thumbList[0];
// form.imgList = JSON.stringify(deciptInfo.detailPictures);
// form.detail = deciptInfo.detailDescribe;
// if (deciptInfo.videoList && deciptInfo.videoList.length !== 0) {
// form.video = deciptInfo.videoList[0];
// form.videoPoster = getPosterFromVideoUrl(form.video);
// } else {
// form.video = "";
// form.videoPoster = "";
// }
// if (
// deciptInfo.nftEnclosureList &&
// deciptInfo.nftEnclosureList.length !== 0
// (!baseInfo.prop ||
// baseInfo.prop.length === 0 ||
// !baseInfo.prop[0].name ||
// !baseInfo.prop[0].val)
// ) {
// form.nftFile = deciptInfo.nftEnclosureList[0];
// // form.videoPoster = getPosterFromVideoUrl(form.video)
// } else {
// form.nftFile = "";
// }
// // console.log('form',form)
// // 快递模板
// // if (!templateId) {
// // return { errMsg: '请选择快递模板!' }
// // }
// // form.templateId = templateId
// // 打包价格
// if (!packageDTO.price && baseInfo.type == 5) {
// return { errMsg: "请填写打包价格" };
// }
// form.packageDTO.price = packageDTO.price;
// // 打包资源
// packageDTO.resource.forEach((item) => {
// if (!item.skuId && baseInfo.type == 5) {
// errMsg = "请选择规格!";
// }
// if (!item.number && item.number != 0 && baseInfo.type == 5) {
// errMsg = "请填写数量!";
// }
// });
// form.packageDTO.resource = packageDTO.resource;
// form.packageDTO.resource = form.packageDTO.resource.map((item) => {
// let { skuId, number } = item;
// return { skuId: skuId, number: number };
// });
// form.packageDTO.resource = JSON.stringify(form.packageDTO.resource);
// if (!packageDTO.stock && baseInfo.type == 5) {
// return { errMsg: "请填写打包库存" };
// }
// form.packageDTO.stock = packageDTO.stock;
// // NFT商品价格
// // console.log('nftdto', nftdto)
// if (!nftdto.price && baseInfo.type == 6) {
// return { errMsg: "请填写商品价格" };
// }
// // NFT类型
// if (!nftdto.type && baseInfo.type == 6 && nftdto.tzType == 1) {
// return { errMsg: "请选择NFT类型" };
// }
// // NFT类型
// if (!nftdto.number && baseInfo.type == 6 && nftdto.type == 2) {
// return { errMsg: "请填写发行数量" };
// }
// form.nftdto = nftdto;
// // 退货类型
// if (!returnType && returnType != 0) {
// return { errMsg: "请选择退货类型" };
// }
// form.returnType = returnType;
// // 自定义退货(退货理由)
// if (returnReason == "" && returnType == 2) {
// return { errMsg: "请描述退货理由" };
// }
// form.returnReason = returnReason;
// // 商品备注
// // if (!note) {
// // return { errMsg: '请填写商品备注' }
// // }
// form.note = note;
// if (!depositType && baseInfo.type == 2) {
// return { errMsg: "请选择预售定金类型" };
// }
// form.preSaleDTO.depositType = depositType;
// // 首付比例
// if (baseInfo.type == 2) {
// if (depositType == 1) {
// deposit = this.fixedProportion;
// } else {
// deposit = this.fixedAmount;
// }
// }
// if (!deposit && baseInfo.type == 2) {
// return { errMsg: "请填写首付比例" };
// }
// form.preSaleDTO.deposit = deposit;
// // 预计提货开始时间
// if (!drawStartTime && baseInfo.type == 2) {
// return { errMsg: "请填写预计提货开始时间" };
// return { errMsg: '请填写 基本信息 - 商品属性!' }
// }
// form.preSaleDTO.drawStartTime = drawStartTime;
// // 预计提货结束时间
// if (!drawEndTime && baseInfo.type == 2) {
// return { errMsg: "请填写预计提货结束时间" };
// }
// form.preSaleDTO.drawEndTime = drawEndTime;
// // 预售开始时间
// if (!saleStartTime && baseInfo.type == 2) {
// return { errMsg: "请填写预售开始时间" };
// }
// form.preSaleDTO.saleStartTime = saleStartTime;
// // 预售结束时间
// if (!saleEndTime && baseInfo.type == 2) {
// return { errMsg: "请填写预售结束时间" };
// }
// form.preSaleDTO.saleEndTime = saleEndTime;
// // 买家保证金
// if (!buyerDeposit && baseInfo.type == 3) {
// return { errMsg: "请填写拍卖保证金" };
// }
// if (
// (buyerDeposit < 0 || !/^\d+$/.test(buyerDeposit)) &&
// baseInfo.type == 3
// ) {
// return { errMsg: "拍卖保证金格式输入有误!" };
// }
// form.auctionDTO.buyerDeposit = buyerDeposit;
// // 出价最小增幅
// if (!priceIncrease && baseInfo.type == 3) {
// return { errMsg: "请填写出价最小增幅" };
if (!baseInfo.categoryId || baseInfo.categoryId.length === 0) {
return { errMsg: "请选择 基本信息 - 所属类目!" };
}
// if (!baseInfo.useNft) {
// return { errMsg: '请填写 基本信息 - 是否应用NFT!' }
// }
// if (
// (priceIncrease < 0 || !/^\d+$/.test(priceIncrease)) &&
// baseInfo.type == 3
// ) {
// return { errMsg: "出价最小增幅格式输入有误!" };
form = { ...form, ...baseInfo };
// 销售信息
if (!saleInfo.salesType) {
return { errMsg: "请选择商品类型" };
}
form.salesType = saleInfo.salesType;
if (!saleInfo.depositType && saleInfo.salesType == 2) {
return { errMsg: "请选择预售定金类型" };
}
form.preSaleDTO.depositType = saleInfo.depositType;
// 首付比例
if (saleInfo.salesType == 2) {
if (saleInfo.depositType == 1) {
deposit = saleInfo.fixedProportion;
} else {
deposit = saleInfo.fixedAmount;
}
}
if (!deposit && saleInfo.salesType == 2) {
return { errMsg: "请填写首付比例" };
}
form.preSaleDTO.deposit = deposit;
// 预计提货开始时间
if (!saleInfo.drawStartTime && saleInfo.salesType == 2) {
return { errMsg: "请填写预计提货开始时间" };
}
form.preSaleDTO.drawStartTime = saleInfo.drawStartTime;
// 预计提货结束时间
if (!saleInfo.drawEndTime && saleInfo.salesType == 2) {
return { errMsg: "请填写预计提货结束时间" };
}
form.preSaleDTO.drawEndTime = saleInfo.drawEndTime;
// 预售开始时间
if (!saleInfo.saleStartTime && saleInfo.salesType == 2) {
return { errMsg: "请填写预售开始时间" };
}
form.preSaleDTO.saleStartTime = saleInfo.saleStartTime;
// 预售结束时间
if (!saleInfo.saleEndTime && saleInfo.salesType == 2) {
return { errMsg: "请填写预售结束时间" };
}
form.preSaleDTO.saleEndTime = saleInfo.saleEndTime;
form.commodityPass = saleInfo.commodityPass;
if (
!saleInfo.shopPrice &&
(saleInfo.salesType == 1 || saleInfo.salesType == 5) &&
baseInfo.type == 4
) {
return { errMsg: "请填写商品价格" };
}
if (
!saleInfo.preSalePrice &&
saleInfo.salesType == 2 &&
baseInfo.type == 4
) {
return { errMsg: "请填写预售价格" };
}
if (
saleInfo.salesType == 2 &&
baseInfo.type == 4 &&
saleInfo.depositType == 2 &&
Number(saleInfo.fixedAmount) > Number(saleInfo.preSalePrice)
) {
return { errMsg: "首付固定金额不能大于商品预售价格" };
}
if (saleInfo.salesType != 3 && baseInfo.type != 4 &&saleInfo.salesType !== 4) {
// console.log('1111')
if (!saleInfo.sku || saleInfo.sku.length === 0) {
return { errMsg: "请完善规格信息!" };
}
let skuIndex = 0;
saleInfo.sku.forEach((item) => {
// console.log('item', item)
if (!item.originalPrice && item.originalPrice != 0) {
errMsg = "请填写 规格信息 - 价格!";
}
if (
saleInfo.salesType == 2 &&
saleInfo.depositType == 2 &&
Number(saleInfo.fixedAmount) > Number(item.originalPrice)
) {
errMsg = "首付固定金额不能大于商品预售价格";
}
if (!item.stock) {
errMsg = "请填写 规格信息 - 库存!";
}
if (!item.hash) {
errMsg = "请填写 规格信息 - 溯源哈希!";
}
// if (this.isAdd && saleInfo.commodityPass == 1 && !item.coinName) {
// errMsg = '请填写 规格信息 - Token名称!'
// }
// form.auctionDTO.priceIncrease = priceIncrease;
// if (!endTime && baseInfo.type == 3) {
// return { errMsg: "请填写拍卖结束时间" };
if (!item.weight && baseInfo.type == 1) {
errMsg = "请填写 规格信息 - 重量!";
}
if ((item.weight && item.weight < 0) || item.weight > 9999) {
errMsg = "规格信息 - 重量 格式不正确!";
}
item.weight = baseInfo.type == 1 ? parseFloat(item.weight) : 0;
if (!/^[0-9]+(.[0-9]{1,2})?$/.test(item.weight)) {
errMsg = "规格信息 - 重量 最多至小数点后两位!";
}
// console.log('coinName', item.coinName)
// if (this.isAdd && saleInfo.commodityPass == 1 && !/^[A-Z0-9]{2,10}$/.test(item.coinName)) {
// errMsg = '规格信息 - Token名称 格式不正确!'
// }
// form.auctionDTO.endTime = endTime;
// // 积分库存
// // if (!stock && baseInfo.type == 4) {
// // return { errMsg: '请填写库存' }
// // }
// // form.pointsExchangeDTO.stock = stock
// // // 积分数量
// // if (!pnum && baseInfo.type == 4) {
// // return { errMsg: '请填写积分数量' }
// // }
// form.pointsExchangeDTO.pnum = pnum;
// // if (!traceabilityNumber) {
// // return { errMsg: '请输入溯源系统的商品溯源编号' }
// // }
// form.traceabilityNumber = traceabilityNumber;
// form.delayDelivery = delayDelivery == true ? "1" : "0";
// return { errMsg, form };
// },
checkForm() {
let form = {
blindBoxPrice: 0,
categoryId:
this.form.baseInfo.categoryId.length > 0
? JSON.stringify(this.form.baseInfo.categoryId)
: "",
commodityPass: 0,
delayDelivery: this.form.delayDelivery ? 1 : 0,
description: this.form.baseInfo.description,
detail: this.form.deciptInfo.detailDescribe,
difficulty: this.form.saleInfo.difficulty,
imgList:
this.form.deciptInfo.detailPictures.length > 0
? JSON.stringify(this.form.deciptInfo.detailPictures)
: "",
name: this.form.baseInfo.name,
nftFile:
this.form.deciptInfo.nftEnclosureList.length > 0
? this.form.deciptInfo.nftEnclosureList[0]
: "",
nftdto: this.form.nftdto,
note: this.form.note,
prop: this.form.baseInfo.prop
? JSON.stringify(this.form.baseInfo.prop)
: "",
returnReason: this.form.returnReason,
returnType: this.form.returnType,
salesType: this.form.saleInfo.salesType,
skuList: [],
thumb:
this.form.deciptInfo.thumbList.length > 0
? this.form.deciptInfo.thumbList[0]
: "",
traceabilityNumber: this.form.traceabilityNumber,
type: this.form.baseInfo.type,
video:
this.form.deciptInfo.videoList.length > 0
? this.form.deciptInfo.videoList[0]
: "",
videoPoster:
this.form.deciptInfo.videoList.length > 0
? getPosterFromVideoUrl(this.form.deciptInfo.videoList[0])
: "",
};
if (this.form.goodsId) {
form.goodsId = this.form.goodsId;
if (item.originalPrice <= 0 || item.originalPrice > 999999) {
errMsg = "规格信息 - 价格 格式不正确!";
}
if (this.form.saleInfo.salesType === 1) {
form.nftdto = {
number: this.form.saleInfo.number,
price: this.form.saleInfo.price,
tokenId: this.form.saleInfo.tokenId,
type: this.form.saleInfo.type,
tzType: this.form.saleInfo.tzType,
};
if (form.type == 6) {
if (this.form.saleInfo.tzType == 1 && this.form.saleInfo.type == 1) {
this.form.saleInfo.number = 1;
form.nftdto.number=1
item.originalPrice = parseFloat(item.originalPrice);
if (!/^[0-9]+(.[0-9]{1,2})?$/.test(item.originalPrice)) {
errMsg = "规格信息 - 价格 最多至小数点后两位!";
}
if (
item.stock < 0 ||
!/^\d+$/.test(item.stock) ||
item.stock > 99999999
) {
errMsg = "规格信息 - 库存 格式不正确!";
}
form.commodityPass = this.form.saleInfo.tzType;
form.skuList = [
{
stock: this.form.saleInfo.number,
propertyList: [
{
propKey: "规格名称",
propVal: " ",
},
],
},
];
} else if (this.form.saleInfo.salesType === 4) {
if (
item.upload &&
item.upload.imageList &&
item.upload.imageList.length !== 0
) {
saleInfo.sku[skuIndex].image = item.upload.imageList[0];
}
skuIndex++;
});
if (errMsg) {
return { errMsg };
}
form.skuList = saleInfo.sku;
}
if (saleInfo.salesType === 4) {
form.commodityPass = this.form.saleInfo.commodityPass;
form.blindBoxPrice = this.form.saleInfo.price;
form.blindBoxRule = this.form.saleInfo.blindBoxRule;
form.difficulty=this.form.saleInfo.difficulty || 3
let skuList = [];
for (let item of this.form.saleInfo.sku) {
let obj = {
......@@ -1289,60 +848,6 @@ export default {
skuList.push(obj);
}
form.skuList = skuList;
}
return form;
},
validateForm() {
let errMsg = "";
if (!this.form.baseInfo) {
errMsg = "请完善基本信息!";
}
if (!this.form.baseInfo.name) {
errMsg = "请填写 基本信息 - 商品名称!";
}
if (!this.form.baseInfo.type) {
errMsg = "请填写 基本信息 - 商品类型!";
}
if (!this.form.baseInfo.description) {
errMsg = "请填写 基本信息 - 商品描述!";
}
if (
!this.form.baseInfo.categoryId ||
this.form.baseInfo.categoryId.length === 0
) {
errMsg = "请填写 基本信息 - 类目选择!";
}
if (!this.form.deciptInfo) {
errMsg = "请完善图文描述!";
}
if (
!this.form.deciptInfo.detailPictures ||
this.form.deciptInfo.detailPictures.length === 0
) {
errMsg = "请上传 图文描述 - 商品图片!";
}
if (
!this.form.deciptInfo.thumbList ||
this.form.deciptInfo.thumbList.length === 0
) {
errMsg = "请上传 图文描述 - 缩略图!";
}
// if (this.form.deciptInfo.detailDescribe.length > 18000) {
// errMsg = "图文描述 - 详情描述 内容长度过长!";
// }
if (this.form.deciptInfo.detailDescribe.length == 0) {
errMsg = "图文描述 - 请输入详情描述!";
}
if (!this.form.saleInfo) {
errMsg = "请完善规格信息!";
} else {
if (!this.form.saleInfo.price) {
errMsg = "请填写商品价格!";
}
if (!this.form.saleInfo.salesType) {
errMsg = "请选择销售模式!";
} else {
if (this.form.saleInfo.salesType === 4) {
if (!this.form.saleInfo.blindBoxRule) {
errMsg = "请完善规格信息 - 盲盒规则!";
}
......@@ -1356,10 +861,7 @@ export default {
// errMsg = "规格信息 - 盲盒规则 内容长度过长!";
// }
if (
!this.form.saleInfo.sku ||
this.form.saleInfo.sku.length === 0
) {
if (!this.form.saleInfo.sku || this.form.saleInfo.sku.length === 0) {
errMsg = "请完善规格信息!";
}
for (let item of this.form.saleInfo.sku) {
......@@ -1388,46 +890,242 @@ export default {
break;
}
}
}else{
if(!this.form.saleInfo.tzType){
errMsg = "请填写 规格信息 - 商品通证!";
}
if(!this.form.saleInfo.type){
errMsg = "请填写 规格信息 - NFT类型!";
// 买家起拍价
if (!saleInfo.startPrice && saleInfo.salesType == 3) {
return { errMsg: "请填写起拍价" };
}
// if ((saleInfo.startPrice < 0 || !/^\d+$/.test(saleInfo.startPrice)) && saleInfo.salesType == 3) {
// return { errMsg: '起拍价格式输入有误!' }
// }
if (saleInfo.startPrice < 0 && saleInfo.salesType == 3) {
return { errMsg: "拍卖起拍价不能小于0!" };
}
form.auctionDTO.startPrice = saleInfo.startPrice;
// console.log('333', saleInfo.buyerDeposit)
// 买家保证金
if (!saleInfo.buyerDeposit && saleInfo.salesType == 3) {
return { errMsg: "请填写拍卖保证金" };
}
// if ((saleInfo.buyerDeposit < 0 || !/^\d+$/.test(saleInfo.buyerDeposit)) && saleInfo.salesType == 3) {
// return { errMsg: '拍卖保证金格式输入有误!' }
// }
if (saleInfo.buyerDeposit < 0 && saleInfo.salesType == 3) {
return { errMsg: "拍卖保证金不能小于0!" };
}
if (
saleInfo.buyerDeposit > saleInfo.startPrice &&
saleInfo.salesType == 3
) {
return { errMsg: "请填写拍卖保证金不能大于起拍价" };
}
if(this.form.saleInfo.type===2&&!this.form.saleInfo.number){
errMsg = "请填写 规格信息 - 发行数量!";
form.auctionDTO.buyerDeposit = saleInfo.buyerDeposit;
// 出价最小增幅
if (!saleInfo.priceIncrease && saleInfo.salesType == 3) {
return { errMsg: "请填写出价最小增幅" };
}
// if ((saleInfo.priceIncrease < 0 || !/^\d+$/.test(saleInfo.priceIncrease)) && saleInfo.salesType == 3) {
// return { errMsg: '出价最小增幅格式输入有误!' }
// }
if (saleInfo.priceIncrease < 0 && saleInfo.salesType == 3) {
return { errMsg: "最小增幅不能小于0!" };
}
form.auctionDTO.priceIncrease = saleInfo.priceIncrease;
if (!saleInfo.endTime && saleInfo.salesType == 3) {
return { errMsg: "请填写拍卖结束时间" };
}
form.auctionDTO.endTime = saleInfo.endTime;
if (!saleInfo.delayPayTime && saleInfo.salesType == 3) {
return { errMsg: "请填写延后天数" };
}
// console.log('1111', saleInfo.delayPayTime)
form.auctionDTO.delayPayTime = saleInfo.delayPayTime;
if (!saleInfo.name && (saleInfo.salesType == 3 || baseInfo.type == 4)) {
return { errMsg: "请填写规格名称" };
}
if (!saleInfo.hash && (saleInfo.salesType == 3 || baseInfo.type == 4)) {
return { errMsg: "请填写溯源哈希" };
}
return errMsg;
// form.auctionDTO.endTime = saleInfo.endTime
if (!saleInfo.price && baseInfo.type == 3) {
return { errMsg: "请填写打包价格" };
}
form.packageDTO.price = saleInfo.price;
// 打包资源
saleInfo.resource.forEach((item) => {
if (!item.skuId && baseInfo.type == 5) {
errMsg = "请选择规格!";
}
if (!item.number && item.number != 0 && baseInfo.type == 3) {
errMsg = "请填写数量!";
}
});
form.packageDTO.resource = saleInfo.resource;
form.packageDTO.resource = form.packageDTO.resource.map((item) => {
let { skuId, number } = item;
return { skuId: skuId, number: number };
});
form.packageDTO.resource = JSON.stringify(form.packageDTO.resource);
if (!saleInfo.stock && baseInfo.type == 3) {
return { errMsg: "请填写打包库存" };
}
form.packageDTO.stock = saleInfo.stock;
// 图文信息
if (!deciptInfo) {
return { errMsg: "请完善图文描述!" };
}
if (
(!deciptInfo.detailPictures ||
deciptInfo.detailPictures.length === 0) &&
baseInfo.type != 4
) {
return { errMsg: "请上传 图文描述 - 商品图片!" };
}
// if (!deciptInfo.videoList || deciptInfo.videoList.length === 0) {
// return { errMsg: '请上传 图文描述 - 商品视频!' }
// }
if (!deciptInfo.thumbList || deciptInfo.thumbList.length === 0) {
return { errMsg: "请上传 图文描述 - 缩略图!" };
}
// if (deciptInfo.detailDescribe.length > 18000) {
// return { errMsg: '图文描述 - 详情描述 内容长度过长!' }
// }
if (deciptInfo.detailDescribe.length == 0) {
return { errMsg: "图文描述 - 请输入详情描述!" };
}
// form = { ...form, ...deciptInfo }
form.thumb = deciptInfo.thumbList[0];
form.imgList =
baseInfo.type == 4
? JSON.stringify([deciptInfo.thumbList[0]])
: JSON.stringify(deciptInfo.detailPictures);
form.detail = deciptInfo.detailDescribe;
if (deciptInfo.videoList && deciptInfo.videoList.length !== 0) {
form.video = deciptInfo.videoList[0];
form.videoPoster = getPosterFromVideoUrl(form.video);
}
// console.log('form',form)
// 快递模板
// if (!templateId) {
// return { errMsg: '请选择快递模板!' }
// }
// form.templateId = templateId
// 退货类型
if (!this.backType) {
return { errMsg: "请选择退货类型" };
}
if (this.customDays == "" && this.backType == 3) {
return { errMsg: "请自定义多少天可以退货" };
}
if (this.backType == 1) {
form.returnType = 0;
} else if (this.backType == 2) {
form.returnType = 7;
} else if (this.backType == 3) {
if (parseInt(this.customDays) > 15) {
return { errMsg: "请自定义最多15天!" };
}
form.returnType = this.customDays;
}
if (saleInfo.salesType === 5) {
form.returnType = 0;
}
// 商品备注
// if (!note) {
// return { errMsg: '请填写商品备注' }
// }
form.note = note;
// 积分库存
// if (!stock && baseInfo.type == 4) {
// return { errMsg: '请填写库存' }
// }
// form.pointsExchangeDTO.stock = stock
// // 积分数量
// if (!pnum && baseInfo.type == 4) {
// return { errMsg: '请填写积分数量' }
// }
form.pointsExchangeDTO.pnum = pnum;
if (traceabilityNumber.length > 100) {
return { errMsg: "溯源系统的商品溯源编号不能大于100位" };
}
form.traceabilityNumber = traceabilityNumber;
form.delayDelivery = delayDelivery == true ? "1" : "0";
return { errMsg, form };
},
handleSubmit() {
let form = this.checkForm();
console.log(form)
let errMsg = this.validateForm();
let { errMsg, form } = this.checkForm();
// return
if (errMsg) {
return this.$Notice.warning({ title: errMsg });
}
if (form.preSaleDTO.drawStartTime > form.preSaleDTO.drawEndTime) {
return this.$Notice.warning("提货开始时间不能大于结束时间");
}
if (form.preSaleDTO.saleStartTime > form.preSaleDTO.saleEndTime) {
return this.$Notice.warning("预售开始时间不能大于结束时间");
}
if (!errMsg) {
form.categoryId = JSON.stringify(form.categoryId);
// console.log('145', form.prop)
form.prop = JSON.stringify(form.prop);
form.type = JSON.parse(form.type);
}
if (!errMsg) {
form.returnType = JSON.parse(form.returnType);
form.preSaleDTO.drawStartTime = new Date(
form.preSaleDTO.drawStartTime
).getTime();
form.preSaleDTO.drawEndTime =
new Date(form.preSaleDTO.drawEndTime).getTime() + 86399000;
form.preSaleDTO.saleStartTime = new Date(
form.preSaleDTO.saleStartTime
).getTime();
form.preSaleDTO.saleEndTime =
new Date(form.preSaleDTO.saleEndTime).getTime() + 86399000;
form.auctionDTO.endTime =
new Date(form.auctionDTO.endTime).getTime() + 86399000;
}
if (!errMsg) {
if (form.salesType == 3) {
form.skuList.forEach((item) => {
item.stock =
form.commodityPass == 2 ? this.form.saleInfo.outStock : 1;
item.skuName = this.form.saleInfo.name;
item.propertyList = [{ propKey: "规格", propVal: item.skuName }];
item.commodityPassId = this.form.saleInfo.id;
item.hash = this.form.saleInfo.hash;
});
}
if (form.type == 4) {
form.skuList.forEach((item) => {
item.stock = 1;
item.skuName = this.form.saleInfo.name;
item.originalPrice =
form.salesType == 1
? this.form.saleInfo.shopPrice
: this.form.saleInfo.preSalePrice;
item.propertyList = [{ propKey: "规格", propVal: item.skuName }];
item.commodityPassId = this.form.saleInfo.id;
item.hash = this.form.saleInfo.hash;
});
}
}
// form.detail
var regex1 = new RegExp(
"(i?)(<p)(?!(.*?style=['\"](.*)['\"])[^>]+>)",
"gmi"
);
form.detail = form.detail?form.detail.replace(regex1, '$2 style="padding:0 10px"$3'):"";
form.blindBoxRule = form.blindBoxRule?form.blindBoxRule.replace(regex1, '$2 style="padding:0 10px"$3'):"";
let apiName =
this.isAdd || this.isDraft
? "addGood"
: this.isAgain
? "republishGood"
: "updateGood";
let title =
this.isAdd || this.isDraft
? "添加成功!"
: this.isAgain
? "重新发布成功!"
: "编辑成功!";
form.detail = form.detail
? form.detail.replace(regex1, '$2 style="padding:0 10px"$3')
: "";
form.blindBoxRule = form.blindBoxRule
? form.blindBoxRule.replace(regex1, '$2 style="padding:0 10px"$3')
: "";
let apiName = this.isAdd || this.isDraft ? "addGood" : "updateGood";
let title = this.isAdd ? "添加成功!" : "编辑成功!";
this.submitLoading = true;
this.api({
apiName,
......@@ -1445,7 +1143,155 @@ export default {
});
},
handleDraft() {
let form = this.checkForm();
let form = {
auctionDTO: {},
pointsExchangeDTO: {},
preSaleDTO: {},
skuList: [
{
coinName: "",
originalPrice: "",
propertyList: [
{
propKey: "",
propVal: "",
},
],
republish: "",
skuId: "",
stock: "",
skuName: "",
},
],
packageDTO: {},
};
let {
goodsId,
baseInfo,
saleInfo,
deciptInfo,
note,
deposit,
pnum,
traceabilityNumber,
delayDelivery,
packageDTO,
} = this.form;
form.goodsId = goodsId;
if (!baseInfo.name) {
return this.$Notice.warning({ title: "请填写商品名称!" });
}
form = { ...form, ...baseInfo };
form.salesType = saleInfo.salesType;
form.preSaleDTO.depositType = saleInfo.depositType;
if (saleInfo.salesType == 2) {
if (saleInfo.depositType == 1) {
deposit = saleInfo.fixedProportion;
} else {
deposit = saleInfo.fixedAmount;
}
}
form.preSaleDTO.deposit = deposit;
form.preSaleDTO.drawStartTime = saleInfo.drawStartTime;
form.preSaleDTO.drawEndTime = saleInfo.drawEndTime;
form.preSaleDTO.saleStartTime = saleInfo.saleStartTime;
form.preSaleDTO.saleEndTime = saleInfo.saleEndTime;
form.commodityPass = saleInfo.commodityPass;
if (saleInfo.salesType != 3 && form.type != 4) {
let skuIndex = 0;
saleInfo.sku.forEach((item) => {
item.weight = parseFloat(item.weight);
item.originalPrice = parseFloat(item.originalPrice);
if (
item.upload &&
item.upload.imageList &&
item.upload.imageList.length !== 0
) {
saleInfo.sku[skuIndex].image = item.upload.imageList[0];
}
skuIndex++;
});
form.skuList = saleInfo.sku;
}
form.auctionDTO.buyerDeposit = saleInfo.buyerDeposit;
form.auctionDTO.startPrice = saleInfo.startPrice;
form.auctionDTO.priceIncrease = saleInfo.priceIncrease;
form.auctionDTO.delayPayTime = saleInfo.delayPayTime;
form.auctionDTO.endTime = saleInfo.endTime;
form.packageDTO.price = saleInfo.price;
// 打包资源
form.packageDTO.resource = saleInfo.resource;
form.packageDTO.resource = form.packageDTO.resource.map((item) => {
let { skuId, number } = item;
return { skuId: skuId, number: number };
});
form.packageDTO.resource = JSON.stringify(form.packageDTO.resource);
form.packageDTO.stock = saleInfo.stock;
form.thumb = deciptInfo.thumbList[0] ? deciptInfo.thumbList[0] : "";
form.imgList =
baseInfo.type == 4
? JSON.stringify([deciptInfo.thumbList[0]])
: JSON.stringify(deciptInfo.detailPictures);
form.detail = deciptInfo.detailDescribe;
if (deciptInfo.videoList && deciptInfo.videoList.length !== 0) {
form.video = deciptInfo.videoList[0];
form.videoPoster = getPosterFromVideoUrl(form.video);
}
if (this.backType == 1) {
form.returnType = 0;
} else if (this.backType == 2) {
form.returnType = 7;
} else if (this.backType == 3) {
form.returnType = this.customDays;
}
if (saleInfo.salesType === 5) {
form.returnType = 0;
}
form.note = note;
form.pointsExchangeDTO.pnum = pnum;
if (traceabilityNumber.length > 100) {
return { errMsg: "溯源系统的商品溯源编号不能大于100位" };
}
form.traceabilityNumber = traceabilityNumber;
form.delayDelivery = delayDelivery == true ? "1" : "0";
form.categoryId = JSON.stringify(form.categoryId);
form.prop = JSON.stringify(form.prop);
form.type = JSON.parse(form.type);
// form.returnType = form.returnType ? JSON.parse(form.returnType) : ''
form.preSaleDTO.drawStartTime = new Date(
form.preSaleDTO.drawStartTime
).getTime();
form.preSaleDTO.drawEndTime =
new Date(form.preSaleDTO.drawEndTime).getTime() + 86399000;
form.preSaleDTO.saleStartTime = new Date(
form.preSaleDTO.saleStartTime
).getTime();
form.preSaleDTO.saleEndTime =
new Date(form.preSaleDTO.saleEndTime).getTime() + 86399000;
form.auctionDTO.endTime =
new Date(form.auctionDTO.endTime).getTime() + 86399000;
if (form.salesType == 3) {
form.skuList.forEach((item) => {
item.stock =
form.commodityPass == 2 ? this.form.saleInfo.outStock : 1;
item.skuName = this.form.saleInfo.name;
item.commodityPassId = this.form.saleInfo.id;
});
}
if (form.type == 4) {
form.skuList.forEach((item) => {
item.stock = 1;
item.skuName = this.form.saleInfo.name;
item.originalPrice =
saleInfo.salesType == 1 || saleInfo.salesType == 5
? this.form.saleInfo.shopPrice
: this.form.saleInfo.preSalePrice;
item.propertyList = [{ propKey: "规格", propVal: item.skuName }];
item.commodityPassId = this.form.saleInfo.id;
});
}
console.log("111111", form.skuList);
this.draftLoading = true;
this.api({
apiName: "draftGood",
......@@ -1522,9 +1368,6 @@ export default {
justify-content: space-around;
}
}
// .submit-con {
// text-align: center;
// }
.submit-bottom {
margin: 0 auto;
width: 50%;
......@@ -1534,6 +1377,9 @@ export default {
// text-align: center;
}
}
// .submit-con {
// text-align: center;
// }
.package-resources {
padding: 5px 36px;
margin-bottom: 10px;
......
<template>
<info-con title="规格信息:" class="sale-info-con">
<!-- <div
<info-con title="销售信息:" class="sale-info-con">
<div class="item">
<label class="label">销售模式:</label>
<RadioGroup v-model="data.salesType" @on-change="changeSalesType">
<Radio :label="1" style="width: 200px" :disabled="isDetail || isEdit|| isDraft|| isAgain"
>普通</Radio
>
<Radio
:label="2"
style="width: 200px"
:disabled="isDetail|| isEdit|| isDraft|| isAgain || packType"
>预售</Radio
>
<Radio
:label="3"
style="width: 200px"
:disabled="isDetail || isEdit|| isDraft|| isAgain || packType"
>拍卖</Radio
>
<Radio :label="4" style="width: 200px" :disabled="isDetail || isEdit|| isDraft|| isAgain "
>盲盒</Radio
>
<Radio :label="5" style="width: 200px" :disabled="isDetail || isEdit|| isDraft|| isAgain"
>免费领取</Radio
>
</RadioGroup>
</div>
<div class="item" v-if="shopStatus != 4">
<label class="label">限购数量:</label>
<Input
v-model.number="data.purchaseLimit"
type="number"
:disabled="isDetail"
placeholder="请输入限购数量"
style="width: 400px"
/>
</div>
<div class="item" v-if="data.salesType == 2 && shopStatus != 3">
<label class="label">预售时间:</label>
<Row class="time">
<Col>
<DatePicker
type="date"
:options="startOption"
:readonly="isDetail "
v-model="data.saleStartTime"
placeholder="请选择开始时间"
style="width: 200px"
></DatePicker>
</Col>
<span></span>
<Col>
<DatePicker
type="date"
:options="endOption"
:readonly="isDetail "
v-model="data.saleEndTime"
placeholder="请选择结束时间"
style="width: 200px"
></DatePicker>
</Col>
</Row>
</div>
<div class="item" v-if="data.salesType == 2 && shopStatus != 3">
<label class="label">预计提货时间:</label>
<Row class="time">
<Col>
<DatePicker
type="date"
:options="drawStartOption"
:readonly="isDetail "
v-model="data.drawStartTime"
placeholder="请选择开始时间"
style="width: 200px"
></DatePicker>
</Col>
<span></span>
<Col>
<DatePicker
type="date"
:options="drawEndOption"
:readonly="isDetail "
v-model="data.drawEndTime"
placeholder="请选择结束时间"
style="width: 200px"
></DatePicker>
</Col>
</Row>
</div>
<div class="item" v-if="data.salesType == 2 && shopStatus != 3">
<label class="label">首付比例:</label>
<RadioGroup v-model="data.depositType">
<Radio
label="1"
:disabled="isDetail "
class="ivu-radio"
style="width: 260px"
>
<span>固定比例</span>
<Input
v-model="data.fixedProportion"
:disabled="isDetail "
style="width: 100px"
/>
<span>%</span>
</Radio>
<Radio
label="2"
:disabled="isDetail "
class="ivu-radio"
style="width: 260px"
>
<span>固定金额</span>
<Input
v-model="data.fixedAmount"
:disabled="isDetail "
style="width: 100px"
/>
<span></span>
</Radio>
</RadioGroup>
</div>
<div class="item" v-if="shopStatus == 3">
<label class="label">打包价格:</label>
<Input
v-model="data.price"
:disabled="isDetail "
placeholder="请输入打包价格"
style="width: 400px"
/>
</div>
<div class="series-info" v-if="shopStatus == 3">
<label class="label">商品库存:</label>
<Input
v-model="data.stock"
:disabled="isDetail "
placeholder="请输入库存"
style="width: 400px"
:maxlength="9"
@on-blur="stockBlur(data.stock)"
/>
</div>
<div class="item" v-if="shopStatus == 3">
<label class="label">打包资源:</label>
<div class="pack-con">
<div
class="pack-item"
v-for="(item, index) of data.resource"
:key="'prop-item-' + index"
>
<AutoComplete
v-model="item.name"
@on-search="handleSearch($event, index)"
placeholder="请输入资源编号或名称"
:disabled="isDetail "
style="width: 215px"
>
<Option
v-for="(item, index) in item.integralMerchantNameList"
:value="item.name"
:key="'state-option-' + index"
>{{ item.name }}</Option
>
</AutoComplete>
<Select
placeholder="请选择资源规格"
class="search-input"
v-model="item.skuId"
:disabled="isDetail "
style="width: 215px; margin: 0 20px"
>
<Option
v-for="(itemb, idx) of item.specificationsList"
:value="itemb.skuId"
:key="itemb.skuId"
@click.native="handleSpecifications(idx, index)"
>{{ itemb.name }}</Option
>
</Select>
<Input
class="prop-val"
placeholder="请设置资源数量"
v-model="item.number"
:disabled="isDetail "
@on-blur="packOnBlur(index, item)"
:maxlength="30"
style="width: 215px"
/>
<span v-if="item.actualNumber && item.actualNumber != 0"
>资源总数:{{ item.actualNumber }}</span
>
<Icon
class="del-con"
type="md-close-circle"
color="#ed4014"
v-if="!isDetail "
:size="20"
@click="delAge(index)"
/>
</div>
<div class="add-btn">
<Button type="info" @click="addAge" v-if="!isDetail && !isEdit&&!isDraft"
>+ 添加</Button
>
</div>
</div>
</div>
<div class="item" v-if="data.salesType == 3 && shopStatus != 3">
<label class="label">起拍价:</label>
<Input
v-model="data.startPrice"
:readonly="isDetail "
type="number"
style="width: 400px"
>
</Input>
</div>
<div class="item" v-if="data.salesType == 3 && shopStatus != 3">
<label class="label">拍卖保证金:</label>
<Input
v-model="data.buyerDeposit"
:readonly="isDetail "
type="number"
style="width: 400px"
>
</Input>
</div>
<div class="item" v-if="data.salesType == 3 && shopStatus != 3">
<label class="label">出价最小增幅:</label>
<Input
v-model="data.priceIncrease"
:readonly="isDetail "
type="number"
style="width: 400px"
>
</Input>
</div>
<div class="item" v-if="data.salesType == 3 && shopStatus != 3">
<label class="label">竞拍结束时间:</label>
<DatePicker
type="date"
:options="buyEndOption"
:readonly="isDetail "
v-model="data.endTime"
placeholder="请选择结束时间"
style="width: 400px"
></DatePicker>
</div>
<div class="item" v-if="data.salesType == 3 && shopStatus != 3">
<label class="label">付款结束时间:</label>
可以延后
<Input
v-model="data.delayPayTime"
:readonly="isDetail "
type="number"
style="width: 150px"
>
</Input>
天付款
</div>
<div
class="item"
v-if="(data.salesType == 3 && shopStatus != 3) || shopStatus == 4"
>
<label class="label">规格名称:</label>
<Input
v-model="data.name"
:readonly="isDetail "
style="width: 400px"
>
</Input>
</div>
<div class="item" v-if="data.salesType == 4">
<label class="label">商品价格:</label>
<Input
v-model="data.price"
:readonly="isDetail"
placeholder="请输入商品价格"
style="width: 400px"
/>
</div>
<div
class="item"
v-if="shopStatus == 4 && (data.salesType == 1 || data.salesType == 5)"
>
<label class="label">商品价格:</label>
<Input
v-model="data.shopPrice"
type="number"
:readonly="isDetail "
style="width: 400px"
>
</Input>
</div>
<div class="item" v-if="shopStatus == 4 && data.salesType == 2">
<label class="label">预售价格:</label>
<Input
v-model="data.preSalePrice"
:readonly="isDetail "
style="width: 400px"
>
</Input>
</div>
<div
class="item"
v-if="
(data.salesType == 1 || data.salesType == 2 || data.salesType == 5) &&
shopStatus != 3 &&
shopStatus != 4
"
v-for="(pItem, pIndex) of propList"
:key="'prop-item-' + pIndex"
>
<label class="label">规格参数:</label>
<Input
style="width:140px;margin-right:10px;"
style="width: 140px; margin-right: 10px"
placeholder="请输入规格名称"
@on-change="delAllSku(pItem, pIndex)"
v-model="pItem.name"
:readonly="isDetail || isEdit"
:readonly="isDetail "
:maxlength="30"
/>
<div class="property-con">
......@@ -25,7 +332,7 @@
placeholder="请输入规格值"
@on-change="delSkuVal(pItem, vIndex)"
v-model="vItem.val"
:readonly="isDetail || isEdit"
:readonly="isDetail "
:maxlength="30"
/>
<Icon
......@@ -34,7 +341,7 @@
color="#ed4014"
:size="20"
@click="delVal(pItem, vIndex)"
v-if="!isDetail && !isEdit"
v-if="!isDetail && !isEdit&&!isDraft && data.salesType != 2"
/>
</div>
<div class="add-btn">
......@@ -43,7 +350,12 @@
shape="circle"
size="small"
@click="addVal(pItem)"
v-if="!isDetail && !isEdit && pItem.valList.length < 10"
v-if="
!isDetail &&
!isEdit &&
pItem.valList.length < 10 &&
data.salesType != 2
"
>+ 添加属性值</Button
>
</div>
......@@ -54,128 +366,209 @@
color="#ed4014"
:size="30"
@click="delProp(pIndex)"
v-if="!isDetail && !isEdit"
v-if="!isDetail && !isEdit&&!isDraft"
/>
</div> -->
<!-- <div class="item">
</div>
<div
class="item"
v-if="
(data.salesType == 1 || data.salesType == 2 || data.salesType == 5) &&
shopStatus != 3 &&
shopStatus != 4
"
>
<div class="empty" />
<div class="opt-btn" v-if="!isDetail && !isEdit">
<div class="opt-btn" v-if="!isDetail && !isEdit&&!isDraft">
<Button type="info" @click="addProp" v-show="propList.length < 3"
>+ 添加属性</Button
>
</div>
</div> -->
<div class="item">
<label class="label">销售模式:</label>
<RadioGroup v-model="data.salesType" @on-change="changeSalesType">
<Radio :label="1" style="width: 200px" :disabled="isDetail || isEdit"
>普通</Radio
</div>
<!-- v-if="shopStatus == 4 || (shopStatus != 3 && shopStatus != 4)" -->
<div
class="item"
v-if="data.salesType == 4 || (shopStatus != 3 && shopStatus != 4)"
>
<Radio :label="4" style="width: 200px" :disabled="isDetail || isEdit"
>盲盒</Radio
<label class="label">商品通证:</label>
<RadioGroup v-model="data.commodityPass">
<!-- <Radio :label="0" style="width:200px" :disabled="isDetail "></Radio> -->
<Radio :label="1" style="width: 200px" :disabled="isDetail || isEdit|| isDraft|| isAgain"
>内部生成</Radio
>
<Radio :label="2" style="width: 200px" :disabled="isDetail || isEdit|| isDraft|| isAgain"
>外部绑定</Radio
>
</RadioGroup>
</div>
<div class="item">
<label class="label">商品价格:</label>
<div
class="item"
v-if="data.salesType == 3 && shopStatus != 3 && data.commodityPass == 2"
>
<label class="label"></label>
<Select
:transfer="true"
placeholder="请选择外部导入的token"
class="search-input"
v-model="data.id"
@on-change="getMoreOutParams(data.id)"
:disabled="isDetail || isEdit|| isDraft|| isAgain"
style="width: 400px"
>
<Option
v-for="(item, index) of newseriesList"
:value="item.commodityPassId"
:key="'series-option-' + index"
:disabled="item.disabled"
>{{ item.labelName }}</Option
>
</Select>
</div>
<div class="item" v-if="shopStatus == 4 || data.salesType == 3">
<label class="label">溯源哈希:</label>
<Input
v-model="data.price"
v-model="data.hash"
:readonly="isDetail"
placeholder="请输入商品价格"
style="width: 400px"
/>
</div>
<div class="item" v-if="data.salesType === 1">
<label class="label">商品通证:</label>
<RadioGroup v-model="data.tzType" @on-change="changeTzType">
<Radio
:label="1"
:disabled="isDetail || isEdit || isAgain"
style="width: 200px"
>内部发行</Radio
<div
class="item"
style="text-align: center"
v-if="
(data.salesType == 1 || data.salesType == 2 || data.salesType == 5) &&
shopStatus != 3 &&
shopStatus != 4
"
>
<Radio
:label="2"
:disabled="isDetail || isEdit || isAgain"
style="width: 200px"
>外部绑定</Radio
<Button
type="primary"
style="margin: auto"
@click="genSkuTable"
v-if="!isDetail && !isEdit&&!isDraft"
>生成价目表</Button
>
</RadioGroup>
</div>
<div class="item" v-if="data.salesType === 4">
<label class="label">商品通证:</label>
<RadioGroup v-model="data.commodityPass">
<Radio :label="1" style="width: 200px" :disabled="isDetail || isEdit"
>是,自动生成Token</Radio
>
<Radio :label="2" style="width: 200px" :disabled="isDetail || isEdit"
>是,使用外部既有Token</Radio
<div
class="tip"
v-if="
!isDetail &&
!isEdit &&
(data.salesType == 1 || data.salesType == 2 || data.salesType == 5) &&
shopStatus != 3 &&
shopStatus != 4
"
>
</RadioGroup>
提示:如修改上述基本属性后,需重新生成价目表!缩略图建议尺寸100 *
100,大小不得超过6MB
</div>
<template v-if="data.salesType == 1">
<div class="item" v-if="data.tzType == 1">
<label class="label">NFT类型:</label>
<RadioGroup v-model="data.type" @on-change="changeType">
<Radio
:label="1"
:disabled="isDetail || isEdit || isAgain"
style="width: 200px"
>单个,不可拷贝</Radio
<template v-if="data.salesType !== 4">
<Table
v-if="
showTable &&
(data.salesType == 1 || data.salesType == 2 || data.salesType == 5) &&
shopStatus != 3 &&
shopStatus != 4
"
border
:columns="columns"
:data="data.sku"
>
<Radio
:label="2"
:disabled="isDetail || isEdit || isAgain"
style="width: 200px"
>可拷贝</Radio
>
</RadioGroup>
</div>
<div class="item" v-if="data.type == 2">
<label class="label">发行数量:</label>
<template slot-scope="{ row, index }" slot="originalPrice">
<span v-if="isDetail">{{ row.originalPrice }}</span>
<Input
v-model="data.number"
:readonly="isDetail || isEdit || isAgain || isDraft"
placeholder="请输入发行数量,正整数"
style="width: 400px"
v-else
placeholder="单位(RMB)"
:value="row.originalPrice"
@on-change="handleInputChange(index, 'originalPrice')"
type="number"
:readonly="isDetail"
/>
</div>
<div class="item" v-if="data.tzType == 2">
<label class="label">绑定NFT:</label>
</template>
<template slot-scope="{ row, index }" slot="stock">
<span v-if="isDetail">{{ row.stock }}</span>
<Input
v-model="data.tokenId"
v-if="isDetail || isEdit || isAgain"
:readonly="isDetail || isEdit || isAgain || isDraft"
style="width: 400px"
v-else
placeholder="整数值"
:value="row.stock"
@on-change="handleInputChange(index, 'stock')"
@on-blur="onBlur(index, row)"
type="number"
:readonly="isDetail || data.commodityPass == 2"
:maxlength="9"
/>
</template>
<template slot-scope="{ row, index }" slot="coinName">
<template v-if="isDetail || isEdit|| isDraft|| isAgain">
<label class="coinName-label">{{ row.coinName || "--" }}</label>
</template>
<template v-else>
<div v-if="data.commodityPass == 0">
<label>--</label>
</div>
<div v-if="data.commodityPass == 1">
<span>系统生成</span>
</div>
<div v-if="data.commodityPass == 2">
<Select
v-else
placeholder="请选择NFT TOKENID"
transfer
v-model="data.tokenId"
@on-change="handleNFT"
style="width: 200px"
:transfer="true"
v-model="data.sku[index].commodityPassId"
@on-change="
getMoreParams(data.sku[index].commodityPassId, index)
"
style="width: 140px"
>
<Option
:value="item.labelName"
v-for="(item, index) of nftList"
:key="`rate-option-${index}`"
v-for="(item, index) of newseriesList"
:value="item.commodityPassId"
:disabled="item.disabled"
:key="'series-option-' + index"
>{{ item.labelName }}</Option
>
</Select>
</div>
<!-- <div class="item">
<label class="label">库存:</label>
</template>
</template>
<template slot-scope="{ row, index }" slot="hash">
<span v-if="isDetail">{{ row.hash }}</span>
<Input
v-model="data.stock"
v-else
:value="row.hash"
@on-change="handleInputChange(index, 'hash')"
:readonly="isDetail"
placeholder="请输入库存,正整数"
/>
</template>
<template slot-scope="{ row, index }" slot="weight">
<span v-if="isDetail">{{ row.weight }}</span>
<Input
v-else
placeholder="单位(KG)"
:value="row.weight"
@on-change="handleInputChange(index, 'weight')"
type="number"
:maxlength="9"
@on-change="inputChangeStock($event)"
:readonly="isDetail || shopStatus == 2"
/>
</div> -->
</template>
<template slot-scope="{ row, index }" slot="image">
<file-upload
:ref="'fileUpload' + index"
:width="46"
style="margin-top: 5px"
v-model="data.sku[index].upload.imageList"
@input="handleUploadInput($event, index)"
:maxNum="1"
:defaultList="data.sku[index].upload.defaultImgList"
:readonly="isDetail"
showWatch
:iconSize="16"
/>
</template>
<template slot-scope="{ index }" slot="opt">
<Button type="error" size="small" @click="delSku(index)">删除</Button>
</template>
</Table>
</template>
<template v-if="data.salesType === 4">
<div class="item" style="text-align: center">
<label class="label">规格列表:</label>
......@@ -224,22 +617,20 @@
@on-change="handleInputChange(index, 'stock')"
@on-blur="onBlur(index, row)"
type="number"
:readonly="isDetail"
:readonly="isDetail || data.commodityPass==2"
:maxlength="9"
/>
</template>
<template slot-scope="{ row, index }" slot="coinName">
<template v-if="isDetail || isEdit || data.sku[index].status == 1">
<label class="coinName-label">{{
row.coinNamePrefix + row.coinName || "--"
}}</label>
<template v-if="isDetail || isEdit|| isDraft|| isAgain || data.sku[index].status == 1">
<label class="coinName-label">{{ row.coinName || "--" }}</label>
</template>
<template v-else>
<div v-if="data.commodityPass == 1">
<label>内部生成</label>
</div>
<div v-if="data.commodityPass == 0">
<label class="coinName-label">{{ coinNamePrefix }}</label>
<label class="coinName-label">{{ row.coinName || "--" }}</label>
<!-- <label class="coinName-label" style="color: #ed4014"
>&nbsp;&nbsp;+&nbsp;&nbsp;</label
> -->
......@@ -249,7 +640,7 @@
@on-change="handleInputChange(index, 'coinName')"
@on-blur="handleInputBlur(index, 'coinName')"
style="width: 140px"
:readonly="isDetail || isEdit || isAgain || isDraft"
:readonly="isDetail || isEdit|| isDraft|| isAgain || isAgain "
:disabled="isDetail || data.sku[index].status == 1"
:maxlength="10"
/>
......@@ -259,12 +650,13 @@
<Select
:transfer="true"
v-model="data.sku[index].commodityPassId"
@on-change="getMoreParams($event,index)"
@on-change="getMoreParams(data.sku[index].commodityPassId, index)"
style="width: 140px"
>
<Option
v-for="(item, index) of nftList"
:value="item.labelName"
v-for="(item, index) of newseriesList"
:value="item.commodityPassId"
:disabled="item.disabled"
:key="'series-option-' + index"
>{{ item.labelName }}</Option
>
......@@ -273,8 +665,9 @@
</template>
</template>
<template slot-scope="{ row, index }" slot="isHide">
<span v-if="isDetail">{{ row.isHide ? "是" : "否" }}</span>
<span v-if="isDetail|| isEdit|| isDraft|| isAgain">{{ row.isHide ? "是" : "否" }}</span>
<Checkbox
v-else
v-model="row.isHide"
@on-change="changIsHidden($event, index)"
></Checkbox>
......@@ -287,8 +680,8 @@
</template>
</Table>
</div>
<div class="item" style="justify-content: flex-end">
<Button type="primary" style="margin: auto" @click="genSkuTable"
<div class="item" style="justify-content: flex-end" v-if="!isDetail && !isEdit&&!isDraft">
<Button type="primary" style="margin: auto" @click="genSkuTableBlindBox"
>添加商品</Button
>
</div>
......@@ -361,392 +754,723 @@
</template>
<script>
import InfoCon from './info-con'
import FileUpload from '_c/file-upload'
import { uploadImgUrl, uploadVideoUrl } from '@/api/apiConfig'
import { apiVerify } from '@/api/apiVerify'
import { getPosterFromVideoUrl } from '@/libs/tools'
import InfoCon from "./info-con";
import FileUpload from "_c/file-upload";
import config from "@/config";
import { deepCopy } from "@/utils/common";
import { uploadImgUrl, uploadVideoUrl } from "@/api/apiConfig";
import axios from "axios";
import { getPosterFromVideoUrl } from "@/libs/tools";
const baseUrl =
process.env.NODE_ENV === "development"
? config.baseUrl.dev
: config.baseUrl.pro;
export default {
props: {
data: {
// type: Object,
default: { sku: [] },
commodityPass: '',
number: '', // 发行数量:只有商户选择“可拷贝”时,才会出现
price: '', // 商品价格
type: '', // NFT类型(1.单个,不可考贝 2.可拷贝)
tzType: '', // 1.内部发行 2.外部绑定
tokenId: '', // 绑定的外部通证id
salesType: 2, // 销售模式
difficulty: 1
commodityPass: "",
saleStartTime: "",
saleEndTime: "",
drawStartTime: "",
drawEndTime: "",
fixedProportion: "",
fixedAmount: "",
depositType: "",
price: "",
startPrice: "",
buyerDeposit: "",
priceIncrease: "",
delayPayTime: "",
endTime: "",
resource: [
{
integralMerchantNameList: [],
goodsId: "",
skuId: "",
number: "",
specificationsList: [],
actualNumber: "",
},
], // 打包资源
outToken: "",
stock: "",
salesType: "",
name: "",
id: "",
outStock: "",
shopPrice: "",
preSalePrice: "",
hash: "",
difficulty: 1,
purchaseLimit:0
},
isDetail: {
type: Boolean,
default: false
default: false,
},
isEdit: {
type: Boolean,
default: false
default: false,
},
isAgain: {
// isSelf: {
// type: Boolean,
// default: false
// },
isDraft: {
type: Boolean,
default: false
default: false,
},
isDraft:{
isAgain: {
type: Boolean,
default: false
default: false,
},
shopStatus: "",
},
watch: {
salesType(val) {
// console.log('111', val)
if (val == 2) {
this.propList = [{ outToken: "", valList: [{ val: "" }] }];
}
},
shopStatus(val, oldVal) {
if (val == 3 || val == 2) {
this.data.salesType = 1;
}
if (val != oldVal) {
this.columns[0].title = "";
this.propList = [{ outToken: "", valList: [{ val: "" }] }];
}
},
},
components: {
InfoCon,
FileUpload
FileUpload,
},
data () {
data() {
return {
propList: [{ name: '', valList: [{ val: '' }] }],
propList: [{ outToken: "", valList: [{ val: "" }] }],
showTable: false,
columns: [],
coinNamePrefix: '',
seriesList: [{}],
name: '',
tokenNumber: '',
numberStock: '',
// rateList: [3, 4, 5, 6, 9, 10, 11, 13],
difficulty: 1,
nftList: [],
seriesList: [],
name: "",
tokenNumber: "",
numberStock: "",
outTokenName: "",
id: "",
drawStartOption: {
// 指定开始限制时间
disabledDate: (date) => {
return date && date.valueOf() < Date.now() - 86400000;
},
},
drawEndOption: {
// 指定终止日期
disabledDate: (date) => {
return date && date.valueOf() < Date.now() - 86400000;
},
},
startOption: {
// 指定开始限制时间
disabledDate: (date) => {
return date && date.valueOf() < Date.now() - 86400000;
},
},
endOption: {
// 指定终止日期
disabledDate: (date) => {
return date && date.valueOf() < Date.now() - 86400000;
},
},
buyEndOption: {
// 指定终止日期
disabledDate: (date) => {
return date && date.valueOf() < Date.now() - 86400000;
},
},
uploadImgUrl,
uploadVideoUrl,
editorOption: {
placeholder: '请输入内容...',
placeholder: "请输入内容...",
modules: {
toolbar: [
[
'bold',
'italic',
"bold",
"italic",
{ header: 2 },
'blockquote',
{ list: 'ordered' },
{ list: 'bullet' },
{ align: [] }
"blockquote",
{ list: "ordered" },
{ list: "bullet" },
{ align: [] },
],
['image', 'video']
]
}
["image", "video"],
],
},
},
editorLoading: false,
editorUploadPercent: 0
}
editorUploadPercent: 0,
// rateList: [3, 4, 5, 6, 9, 10, 11, 13]
};
},
computed: {
platform () {
platform() {
return (
this.$store.state.admin.type == 1 || this.$store.state.admin.type == 4
)
);
},
packType() {
return this.shopStatus == 3;
},
editor () {
return this.$refs.myQuillEditor.quill
newseriesList() {
let arr = deepCopy(this.seriesList);
arr.forEach((item) => {
// console.log(this.data.sku.find(x => { return x.commodityPassId === item.commodityPassId }))
if (
this.data.sku.find((x) => {
return x.commodityPassId === item.commodityPassId;
})
) {
// console.log(item)
item.disabled = true;
}
// item.stringData = JSON.stringify(item)
});
// console.log(arr)
return arr;
},
mounted () {
this.editor.getModule('toolbar').addHandler('image', this.imgHandler)
this.editor.getModule('toolbar').addHandler('video', this.videoHandler)
this.genPropList(this.data.sku)
this.genColumn()
this.getNftList()
if (!this.platform) {
this.getMerchantPrefixInfo()
},
async mounted() {
this.genPropList(this.data.sku);
if(this.data.salesType===4){
this.genColumnBlindBox();
}else{
this.genColumn();
}
// if (!this.platform) {
// this.getMerchantPrefixInfo()
// }
if (!this.platform) {
this.getunbindToken()
this.seriesList = await this.getunbindToken();
}
this.data.sku.forEach((item) => {
this.numberStock = item.stock
// console.log('item', item)
this.numberStock = item.stock;
if (this.isAgain) {
item.republish = false
item.republish = false;
}
item.coinNamePrefix = item.coinName.substring(0, 4)
item.coinName = item.coinName.substring(4)
// console.log('coinName', item.coinName)
if (item.outToken) {
let obj = JSON.parse(item.outToken);
obj.disabled = true;
if (
!this.seriesList.some((x) => {
return x.commodityPassId === obj.commodityPassId;
})
setTimeout(() => {})
) {
this.seriesList.push(obj);
}
// if (this.seriesList.find(x => { return x.commodityPassId !== obj.commodityPassId })) {
// console.log(11111)
// this.seriesList.push(obj)
// }
}
// console.log('1', this.data.commodityPass)
// if (this.$store.state.admin.type == 2 && this.data.commodityPass != 2) {
// item.coinNamePrefix = item.coinName.substring(0, 6)
// item.coinName = item.coinName.substring(6)
// } else if (this.$store.state.admin.type == 3 && this.data.commodityPass != 2) {
// item.coinNamePrefix = item.coinName.substring(0, 2)
// item.coinName = item.coinName.substring(2)
// } else {
// item.coinNamePrefix = ''
// }
// console.log('coinName', item.coinName)
});
// console.log('154', this.data.outToken)
this.showTable = true;
setTimeout(() => {});
},
methods: {
// inputChangeStock (e) {
// this.data.stock = e.target.value
// },
handleNFT(val){
let obj=this.nftList.filter(x=>{
return x.labelName===val
})
this.data.number=obj&&obj.length>0?obj[0].availableNumber:2
},
changeTzType () {
this.data.type = ''
this.data.number = ''
this.data.tokenId = ''
format(val) {
return "难度系数: " + val + "";
},
changeSalesType (val) {
changeSalesType(val) {
if (val === 4) {
if (this.data.sku.length == 0 || !this.data.sku) {
this.genSkuTable()
this.data.sku = [];
this.columns = [];
this.genSkuTableBlindBox();
if(!this.data.commodityPass){
this.data.commodityPass=1
}
} else if (val === 1) {
this.data.sku = [];
this.columns = [];
this.genColumn();
} else {
this.data.salesType = val
this.data.salesType = val;
}
},
changeType () {
this.data.number = ''
addAge() {
// console.log('111111111111')
this.data.resource.push({
integralMerchantNameList: [],
goodsId: "",
skuId: "",
number: "",
specificationsList: [],
actualNumber: "",
});
},
getNftList () {
// 获取外部NFT
delAge(index) {
this.data.resource.splice(index, 1);
},
handleSearch(goodsInfo, index) {
if (!goodsInfo) {
return this.$Message.warning("请先输入资源编号以便查询!");
}
this.api({
apiName: 'externnftlist',
apiName: "spugetbyvague",
postdata: goodsInfo,
success: (res) => {
// console.log('333', this.nftList)
this.nftList = res.data
}
this.data.resource[index].integralMerchantNameList = res.data;
if (this.data.resource[index].integralMerchantNameList.length === 1) {
let goodsId =
this.data.resource[index].integralMerchantNameList[0].goodsId;
this.api({
apiName: "skugetbygoodsId",
postdata: goodsId,
success: (res) => {
let arr = [];
let list = this.data.resource[index].specificationsList;
if (list && list.length > 0) {
for (let item of res.data) {
if (
list.find((x) => {
return x.skuId === item.skuId;
})
) {
item.stock = list.find((x) => {
return x.skuId === item.skuId;
}).stock;
}
arr.push(item);
}
} else {
arr = res.data;
}
this.data.resource[index].specificationsList = arr;
},
format (val) {
return '难度系数: ' + val + ''
});
}
},
getMoreParams (val, index) {
let obj=this.nftList.filter(x=>{
return x.labelName===val
})
this.tokenNumber = val.availableNumber
this.data.sku[index].stock =obj&&obj.length>0?obj[0].availableNumber:2
});
},
handleSpecifications(idx, index) {
this.idx = idx;
this.data.resource[index].number = "";
for (var i = 0; i < this.data.resource.length - 1; i++) {
for (var j = i + 1; j < this.data.resource.length; j++) {
if (this.data.resource[i].skuId === this.data.resource[j].skuId) {
let title = "规格信息不能重复!";
this.data.resource[index].skuId = "";
return this.$Notice.error({ title });
}
}
}
},
getMoreParams(val, index) {
let item = this.seriesList.find((x) => {
return x.commodityPassId === val;
});
this.tokenNumber = item.availableNumber;
this.data.sku[index].stock = Number(item.availableNumber).toFixed();
console.log("item", item);
this.data.sku[index].hash = item.hash;
console.log("item", item.hash);
},
getMoreOutParams(val) {
let item = this.seriesList.find((x) => {
return x.commodityPassId === val;
});
this.data.id = val;
this.data.outStock = Number(item.availableNumber).toFixed();
},
stockBlur(val) {
let skuNumber = this.data.resource;
skuNumber.forEach((item, index) => {
let number = item.number * val;
let n = NaN;
for (let i = 0, len = item.specificationsList.length; i < len; i++) {
if (item.specificationsList[i].skuId === item.skuId) {
n = i;
break;
}
}
if (number > item.specificationsList[n].stock) {
this.data.resource[index].number = "";
return this.$Notice.warning({
title: `库存 * 填写的资源量不能超过总资源数量`,
});
}
});
},
changIsHidden (val, index) {
this.data.sku[index].isHide = val
},
onBlur (index, val) {
onBlur(index, val) {
// console.log('4444', this.data.commodityPass)
if (
!this.isEdit &&
JSON.parse(val.stock) > this.tokenNumber &&
this.data.commodityPass == 2
) {
this.data.sku[index].stock = parseInt(this.tokenNumber)
return this.$Notice.warning({
title: `填写库存过多 (实际数量:${parseInt(this.tokenNumber)})`
})
// if (!this.isEdit && JSON.parse(val.stock) > this.tokenNumber && this.data.commodityPass == 2) {
// this.data.sku[index].stock = parseInt(this.tokenNumber)
// return this.$Notice.warning({ title: `填写库存过多 (实际数量:${parseInt(this.tokenNumber)})` })
// }
// if (this.isEdit && this.data.commodityPass == 2) {
// let number = JSON.parse(val.stock) - this.numberStock
// // + this.data.sku[index].balanceNum
// if (number > this.data.sku[index].balanceNum) {
// this.data.sku[index].stock = parseInt(this.numberStock + this.data.sku[index].balanceNum)
// return this.$Notice.warning({ title: `填写库存过多 (实际数量:${parseInt(this.numberStock + this.data.sku[index].balanceNum)})` })
// }
// }
},
packOnBlur(index, val) {
for (let i = 0, len = val.specificationsList.length; i < len; i++) {
if (val.specificationsList[i].skuId === val.skuId) {
this.idx = i;
break;
}
if (this.isEdit && this.data.commodityPass == 2) {
let number = JSON.parse(val.stock) - this.numberStock
// + this.data.sku[index].balanceNum
if (number > this.data.sku[index].balanceNum) {
this.data.sku[index].stock = parseInt(
this.numberStock + this.data.sku[index].balanceNum
)
return this.$Notice.warning({
title: `填写库存过多 (实际数量:${parseInt(
this.numberStock + this.data.sku[index].balanceNum
)})`
})
}
let idx = this.idx;
this.data.resource[index].actualNumber =
this.data.resource[index].specificationsList[idx].stock;
this.$set(this.data.resource, index, this.data.resource[index]);
let stockNumber = JSON.parse(val.number) * this.data.stock;
if (stockNumber > this.data.resource[index].actualNumber) {
this.data.resource[index].number = "";
return this.$Notice.warning({
title: `库存*填写的资源量不能超过总资源数量`,
});
}
},
getMerchantPrefixInfo () {
getunbindToken() {
return new Promise((resolve, reject) => {
this.api({
apiName: 'getMerchantPrefix',
apiName: "unbindToken",
success: (res) => {
this.coinNamePrefix = res.data
}
})
// this.seriesList = res.data
resolve(res.data);
},
getunbindToken () {
this.api({
apiName: 'unbindToken',
success: (res) => {
this.seriesList = res.data
}
})
});
});
},
handleInputChange (index, key) {
this.data.sku[index][key] = event.target.value
handleInputChange(index, key) {
this.data.sku[index][key] = event.target.value;
},
handleInputBlur (index, key) {
handleInputBlur(index, key) {
if (this.isAgain) {
if (key == 'coinName') {
this.data.sku[index].republish = true
this.data.sku[index].coinNamePrefix = this.coinNamePrefix
if (key == "coinName") {
this.data.sku[index].republish = true;
}
}
},
handleUploadInput (e, index) {
console.log(index, this.data.sku)
handleUploadInput(e, index) {
console.log(index, this.data.sku);
// this.data.sku[index].upload.imageList = e;
// this.data.sku[index].upload.defaultImgList = e.slice(0)
},
addProp () {
this.propList.push({ name: '', valList: [{ val: '' }] })
addProp() {
this.propList.push({ name: "", valList: [{ val: "" }] });
},
delAllSku (item, index) {
this.data.sku = []
delAllSku(item, index) {
this.data.sku = [];
this.propList[index].valList = [{ val: '' }]
this.data.commodityPass = ''
this.columns[0].title = ''
this.propList[index].valList = [{ val: "" }];
this.data.commodityPass = "";
this.columns[0].title = "";
},
delSkuVal (item, index) {
this.data.sku = []
this.data.commodityPass = ''
this.columns[0].title = ''
delSkuVal(item, index) {
this.data.sku = [];
this.data.commodityPass = "";
this.columns[0].title = "";
},
delProp (index) {
this.propList.splice(index, 1)
delProp(index) {
this.propList.splice(index, 1);
},
addVal (item) {
item.valList.push({ val: '' })
addVal(item) {
item.valList.push({ val: "" });
},
delVal (item, index) {
item.valList.splice(index, 1)
delVal(item, index) {
item.valList.splice(index, 1);
},
delSku (index) {
this.data.sku.splice(index, 1)
delSku(index) {
this.data.sku.splice(index, 1);
},
genPropList (sku) {
genPropList(sku) {
if (sku && sku.length !== 0) {
let propHashTable = {}
let propHashTable = {};
sku.forEach((sItem) => {
if (!sItem.propertyList || sItem.propertyList.length === 0) {
return
return;
}
sItem.propertyList.forEach((pItem) => {
if (propHashTable[pItem.propKey]) {
propHashTable[pItem.propKey][pItem.propVal] = 'x'
propHashTable[pItem.propKey][pItem.propVal] = "x";
} else {
propHashTable[pItem.propKey] = {
[pItem.propVal]: 'x'
[pItem.propVal]: "x",
};
}
}
})
})
this.propList = []
});
});
this.propList = [];
for (let key in propHashTable) {
let valList = []
let valList = [];
for (let vkey in propHashTable[key]) {
valList.push({ val: vkey })
valList.push({ val: vkey });
}
this.propList.push({ name: key, valList })
this.propList.push({ name: key, valList });
}
}
},
genSkuTable () {
// let check = true
// let title = ''
// if (!this.propList || this.propList.length === 0) {
// check = false
// title = '请添加属性!'
// }
// let propNameHashTable = {}
// this.propList.find((pItem) => {
// let propName = pItem.name
// if (!propName) {
// title = '属性名称不能为空!'
// check = false
// return true
// }
// if (propNameHashTable[propName]) {
// title = '属性名称不能重复!'
// check = false
// return true
// }
// if (
// [
// 'originalPrice',
// 'stock',
// 'coinName',
// 'image',
// 'imageList',
// 'defaultImgList',
// 'propertyList'
// ].includes(propName)
// ) {
// title = '属性名称不符合规范!'
// check = false
// return true
// }
// propNameHashTable[propName] = true
// if (!pItem.valList || pItem.valList.length === 0) {
// title = '属性值不能为空!'
// check = false
// return true
// }
// pItem.valList.find((vItem) => {
// if (!vItem.val) {
// title = '属性值不能为空!'
// check = false
// return true
// }
// })
// for (var i = 0; i < pItem.valList.length - 1; i++) {
// for (var j = i + 1; j < pItem.valList.length; j++) {
// if (pItem.valList[i].val === pItem.valList[j].val) {
// title = '属性值不能重复!'
// check = false
// return true
// }
// }
// }
// })
genSkuTable() {
let check = true;
let title = "";
if (!this.propList || this.propList.length === 0) {
check = false;
title = "请添加属性!";
}
let propNameHashTable = {};
this.propList.find((pItem) => {
let propName = pItem.name;
if (!propName) {
title = "属性名称不能为空!";
check = false;
return true;
}
if (propNameHashTable[propName]) {
title = "属性名称不能重复!";
check = false;
return true;
}
if (
[
"originalPrice",
"stock",
"coinName",
"image",
"imageList",
"defaultImgList",
"propertyList",
].includes(propName)
) {
title = "属性名称不符合规范!";
check = false;
return true;
}
propNameHashTable[propName] = true;
if (!pItem.valList || pItem.valList.length === 0) {
title = "属性值不能为空!";
check = false;
return true;
}
pItem.valList.find((vItem) => {
if (!vItem.val) {
title = "属性值不能为空!";
check = false;
return true;
}
});
for (var i = 0; i < pItem.valList.length - 1; i++) {
for (var j = i + 1; j < pItem.valList.length; j++) {
if (pItem.valList[i].val === pItem.valList[j].val) {
title = "属性值不能重复!";
check = false;
return true;
}
}
}
});
// if (!check) {
// this.$Notice.warning({ title })
// } else {
// // console.log(typeof this.data.commodityPass)
// if (typeof this.data.commodityPass !== 'number') {
// return this.$Notice.warning({ title: '请先选择商品通证' })
// }
if (!this.columns || !this.columns.length === 0) {
this.genColumn()
if (!check) {
this.$Notice.warning({ title });
} else {
if (this.data.commodityPass == 0) {
return this.$Notice.warning({ title: "请先选择商品通证" });
}
this.genColumn();
this.genSku();
this.showTable = true;
}
this.genSku()
// }
},
genColumn () {
let columns = []
genColumn() {
let columns = [];
this.propList.forEach((pItem) => {
columns.push({
title: '规格名称',
title: pItem.name,
minWidth: 120,
slot: 'name',
align: 'center'
})
})
key: pItem.name,
align: "center",
});
});
columns.push({
title: '缩略图',
slot: 'image',
title: "缩略图",
slot: "image",
width: 240,
align: 'center'
})
align: "center",
});
columns.push({
title: "价格(¥)",
slot: "originalPrice",
width: 160,
align: "center",
});
columns.push({
title: "商品Token",
slot: "coinName",
width: 230,
align: "center",
});
columns.push({
title: "溯源哈希",
slot: "hash",
width: 180,
align: "center",
});
columns.push({
title: "重量(KG)",
slot: "weight",
width: 130,
align: "center",
});
columns.push({
title: "库存",
slot: "stock",
width: 160,
align: "center",
});
if (!this.isDetail && !this.isEdit && !this.isAgain) {
columns.push({
title: "操作",
slot: "opt",
width: 80,
align: "center",
});
}
this.columns = columns;
},
genSku() {
let resArr = [];
this.propList.forEach((item) => {
resArr = this.genSkuData(item, resArr);
});
this.data.sku = resArr;
},
genSkuData(prop, resArr) {
let newArr = [];
let { name, valList } = prop;
if (resArr.length === 0) {
valList.forEach((item) => {
let propertyList = [{ propKey: name, propVal: item.val }];
newArr.push({
[name]: item.val,
originalPrice: 0,
stock: "",
coinName: "",
// coinNamePrefix: this.coinNamePrefix,
outToken: "",
republish: false,
// availableNumber: '',
image: "",
propertyList,
// rate: 0,
// typeCode: '',
hash: "",
weight: 0,
upload: {
imageList: [],
defaultImgList: [],
},
});
});
// console.log('newArr1', newArr)
} else {
resArr.forEach((rItem) => {
valList.forEach((vItem) => {
let newItem = { ...rItem, [name]: vItem.val };
newItem.propertyList = JSON.parse(
JSON.stringify(newItem.propertyList)
);
newItem.propertyList.push({
propKey: name,
propVal: vItem.val,
});
newItem.upload = {
imageList: [],
defaultImgList: [],
};
// console.log('newItem', newItem)
newArr.push(newItem);
});
});
}
// console.log('newArr', newArr)
return newArr;
},
genSkuTableBlindBox() {
if(this.columns.length===0){
this.genColumnBlindBox();
}
this.genSkuBlindBox();
},
genColumnBlindBox() {
let columns = [];
this.propList.forEach((pItem) => {
columns.push({
title: "规格名称",
minWidth: 120,
slot: "name",
align: "center",
});
});
columns.push({
title: '重量(KG)',
slot: 'weight',
title: "缩略图",
slot: "image",
width: 240,
align: "center",
});
columns.push({
title: "重量(KG)",
slot: "weight",
width: 130,
align: 'center'
})
align: "center",
});
columns.push({
title: '库存',
slot: 'stock',
title: "库存",
slot: "stock",
width: 160,
align: 'center'
})
align: "center",
});
columns.push({
title: '商品Token',
slot: 'coinName',
title: "商品Token",
slot: "coinName",
width: 230,
align: 'center'
})
align: "center",
});
columns.push({
title: '是否是隐藏款',
slot: 'isHide',
title: "是否是隐藏款",
slot: "isHide",
width: 110,
align: 'center'
})
align: "center",
});
// columns.push({
// title: '类型编码',
// slot: 'typeCode',
......@@ -763,149 +1487,151 @@ export default {
// }
if (!this.isDetail && !this.isEdit && !this.isAgain) {
columns.push({
title: '操作',
slot: 'opt',
title: "操作",
slot: "opt",
width: 80,
align: 'center'
})
align: "center",
});
}
this.columns = columns
console.log(columns);
this.columns = columns;
},
genSku () {
let resArr = []
genSkuBlindBox() {
let resArr = [];
this.propList.forEach((item) => {
resArr = this.genSkuData(item, resArr)
})
resArr = this.genSkuDataBlindBox(item, resArr);
});
if (this.data.sku.length === 0) {
this.data.sku = resArr
this.data.sku = resArr;
} else {
this.data.sku = [...this.data.sku, ...resArr]
this.data.sku = [...this.data.sku, ...resArr];
}
console.log(this.data.sku)
},
genSkuData (prop, resArr) {
let newArr = []
let { name, valList } = prop
genSkuDataBlindBox(prop, resArr) {
let newArr = [];
let { name, valList } = prop;
if (resArr.length === 0) {
valList.forEach((item) => {
let propertyList = [{ propKey: name, propVal: item.val }]
let propertyList = [{ propKey: name, propVal: item.val }];
newArr.push({
[name]: item.val,
originalPrice: '',
stock: '',
coinName: '',
originalPrice: "",
stock: "",
coinName: "",
coinNamePrefix: this.coinNamePrefix,
name: '',
name: "",
republish: false,
// availableNumber: '',
image: '',
image: "",
propertyList,
weight: '',
weight: "",
upload: {
imageList: [],
defaultImgList: []
defaultImgList: [],
},
isHide: false
})
})
isHide: false,
});
});
// console.log('newArr1', newArr)
} else {
resArr.forEach((rItem) => {
valList.forEach((vItem) => {
let newItem = { ...rItem, [name]: vItem.val }
let newItem = { ...rItem, [name]: vItem.val };
newItem.propertyList = JSON.parse(
JSON.stringify(newItem.propertyList)
)
);
newItem.propertyList.push({
propKey: name,
propVal: vItem.val
})
propVal: vItem.val,
});
newItem.upload = {
imageList: [],
defaultImgList: []
}
defaultImgList: [],
};
// console.log('newItem', newItem)
newArr.push(newItem)
})
})
newArr.push(newItem);
});
});
}
// console.log('newArr', newArr)
return newArr
return newArr;
},
imgHandler (image) {
imgHandler(image) {
if (image) {
this.$refs.uploadImg.$el.querySelector('[type=file]').click()
this.$refs.uploadImg.$el.querySelector("[type=file]").click();
}
},
videoHandler (video) {
videoHandler(video) {
if (video) {
this.$refs.uploadVideo.$el.querySelector('[type=file]').click()
this.$refs.uploadVideo.$el.querySelector("[type=file]").click();
}
},
uploadOnProgress (event, file, fileList) {
this.editorUploadPercent = parseFloat(event.percent).toFixed(1)
uploadOnProgress(event, file, fileList) {
this.editorUploadPercent = parseFloat(event.percent).toFixed(1);
},
imgBoforeUpload (file) {
imgBoforeUpload(file) {
if (file.size >= 5 * 1024 * 1024) {
this.$Notice.warning({ title: '上传图片不得超过5MB!' })
return false
this.$Notice.warning({ title: "上传图片不得超过5MB!" });
return false;
}
this.editorUploadPercent = 0
this.editorLoading = true
this.editorUploadPercent = 0;
this.editorLoading = true;
},
imgUploadSuccess (res, file, fileList) {
this.editorLoading = false
imgUploadSuccess(res, file, fileList) {
this.editorLoading = false;
apiVerify({
res: { data: res },
success: () => {
let url = res.data
let addImageRange = this.editor.getSelection()
let newRange = 0 + (addImageRange !== null ? addImageRange.index : 0)
this.editor.insertEmbed(newRange, 'simpleImg', {
let url = res.data;
let addImageRange = this.editor.getSelection();
let newRange = 0 + (addImageRange !== null ? addImageRange.index : 0);
this.editor.insertEmbed(newRange, "simpleImg", {
url,
width: '100%'
})
this.editor.setSelection(1 + newRange)
}
})
width: "100%",
});
this.editor.setSelection(1 + newRange);
},
imgUploadErr () {
this.editorLoading = false
this.$Notice.error({ title: '上传失败,请稍后再试!' })
});
},
imgUploadErr() {
this.editorLoading = false;
this.$Notice.error({ title: "上传失败,请稍后再试!" });
},
videoBoforeUpload (file) {
videoBoforeUpload(file) {
if (file.size >= 50 * 1024 * 1024) {
this.$Notice.warning({ title: '上传视频不得超过50MB!' })
return false
this.$Notice.warning({ title: "上传视频不得超过50MB!" });
return false;
}
this.editorUploadPercent = 0
this.editorLoading = true
this.editorUploadPercent = 0;
this.editorLoading = true;
},
videoUploadSuccess (res, file, fileList) {
this.editorLoading = false
videoUploadSuccess(res, file, fileList) {
this.editorLoading = false;
apiVerify({
res: { data: res },
success: () => {
let url = res.data
let addVideoRange = this.editor.getSelection()
let newRange = 0 + (addVideoRange !== null ? addVideoRange.index : 0)
this.editor.insertEmbed(newRange, 'simpleVideo', {
let url = res.data;
let addVideoRange = this.editor.getSelection();
let newRange = 0 + (addVideoRange !== null ? addVideoRange.index : 0);
this.editor.insertEmbed(newRange, "simpleVideo", {
url,
controls: 'controls',
width: '100%',
poster: getPosterFromVideoUrl(url)
})
this.editor.setSelection(1 + newRange)
}
})
controls: "controls",
width: "100%",
poster: getPosterFromVideoUrl(url),
});
this.editor.setSelection(1 + newRange);
},
videoUploadErr () {
this.editorLoading = false
this.$Notice.error({ title: '上传失败,请稍后再试!' })
}
}
}
});
},
videoUploadErr() {
this.editorLoading = false;
this.$Notice.error({ title: "上传失败,请稍后再试!" });
},
},
};
</script>
<style lang="less">
......@@ -913,11 +1639,10 @@ export default {
.item {
display: flex;
align-items: center;
margin-bottom: 10px;
margin-bottom: 30px;
}
.item .label {
width: 140px;
// min-width: 140px;
margin-right: 10px;
text-align: right;
flex-shrink: 0;
......@@ -948,6 +1673,30 @@ export default {
flex: 1;
}
}
.item .pack-con {
width: 800px;
// flex: 1;
padding: 20px;
border: 1px solid #dcdee2;
border-radius: 5px;
display: flex;
flex-wrap: wrap;
align-items: center;
}
.item .pack-con .add-btn {
width: 100%;
}
.item .pack-item {
// width: 240px;
display: flex;
align-items: center;
margin-bottom: 10px;
padding-right: 30px;
.prop-val {
flex: 1;
}
}
.item .empty {
width: 150px;
}
......@@ -964,6 +1713,11 @@ export default {
.token-label {
font-size: 14px;
}
.item .time {
display: flex;
justify-content: space-around;
}
.item .editor-con {
position: relative;
width: 600px;
......
......@@ -28,6 +28,13 @@
:defaultList="this.defaultThumb"
/>
</FormItem>
<FormItem label="广告图:" prop="adThumb" class="shopList">
<file-upload
v-model="advertisingthum"
:maxNum="1"
:defaultList="this.defaultAdvertisingthum"
/>
</FormItem>
</Form>
<div slot="footer">
......@@ -50,6 +57,13 @@
:model="eidtCate"
:label-width="120"
>
<FormItem label="类目ID:" prop="categoryId" class="shopList">
<Input
v-model="eidtCate.categoryId"
:maxlength="60"
disabled
/>
</FormItem>
<FormItem label="类目名称:" prop="name" class="shopList">
<Input
placeholder="请输入类目名称"
......@@ -65,6 +79,13 @@
:defaultList="this.defaultThumb"
/>
</FormItem>
<FormItem label="广告图:" prop="adThumb" class="shopList">
<file-upload
v-model="advertisingthum"
:maxNum="1"
:defaultList="this.defaultAdvertisingthum"
/>
</FormItem>
</Form>
<div slot="footer">
......@@ -147,6 +168,7 @@ export default {
console.log('data', data)
this.modal10 = true
this.thum = []
this.advertisingthum = []
this.type = 1
this.addCate.categoryId = data.categoryId
this.addCate.level = data.level
......@@ -174,16 +196,20 @@ export default {
categoryId: '',
level: 0,
name: '',
thumb: ''
thumb: '',
adThumb: ''
},
eidtCate: {
categoryId: '',
updateTime: '',
name: '',
thumb: ''
thumb: '',
adThumb: ''
},
defaultThumb: [],
thum: [],
advertisingthum: [],
defaultAdvertisingthum: [],
type: 1
}
......@@ -219,6 +245,7 @@ export default {
}
}, data.thumb),
h('span', data.title)
// h('span', `${data.title} (类目ID:${data.categoryId})`)
]),
h('span', {
style: {
......@@ -238,12 +265,14 @@ export default {
},
on: {
click: () => {
console.log('data', data)
// console.log('data', data)
this.thum = []
this.advertisingthum = []
this.type = 2
this.modal10 = true
this.eidtCate.name = data.title
this.thum.push(data.thumb)
this.advertisingthum = data.adThumb ? [data.adThumb] : []
this.eidtCate.categoryId = data.categoryId
this.eidtCate.updateTime = data.updateTime
}
......@@ -262,9 +291,10 @@ export default {
on: {
click: () => {
// console.log('data', data)
console.log('this.eidtCate.name', this.eidtCate.name)
// console.log('this.eidtCate.name', this.eidtCate.name)
this.modal10 = true
this.thum = []
this.advertisingthum = []
this.type = 1
this.addCate.categoryId = data.categoryId
this.addCate.level = data.level
......@@ -326,19 +356,24 @@ export default {
},
// 添加商品目录
updateCategory () {
if (!this.addCate.name) {
this.$Message.warning(`请填写类目名称!`)
if (this.thum.length == 0 || !this.addCate.name) {
this.$Message.warning(`所有项均为必填项哦!`)
return
}
// this.updatePwdLoading = true
this.addCate.thumb = this.thum[0]
// console.log('addCate',this.addCate)
if (this.advertisingthum.length != 0) {
this.addCate.adThumb = this.advertisingthum[0]
}
// console.log('addCate', this.addCate)
this.api({
apiName: 'categorySave',
postdata: this.addCate,
success: (res) => {
// console.log('res',res.data)
this.thum = []
this.advertisingthum = []
this.addCate.name = ''
this.modal10 = false
this.categoryList()
......@@ -347,13 +382,20 @@ export default {
},
// 修改商品类目
eidotCategory () {
if (!this.eidtCate.name) {
this.$Message.warning(`请填写类目名称!`)
if (this.thum.length == 0 || !this.eidtCate.name) {
this.$Message.warning(`所有项均为必填项哦!`)
return
}
// this.updatePwdLoading = true
this.eidtCate.thumb = this.thum[0]
// console.log('addCate', this.eidtCate)
if (this.advertisingthum.length != 0) {
// console.log('1111111111')
this.eidtCate.adThumb = this.advertisingthum[0]
} else {
// console.log('1111111111', this.advertisingthum.length)
this.eidtCate.adThumb = ''
}
// console.log('eidtCate', this.eidtCate)
this.api({
apiName: 'categoryUpdate',
postdata: this.eidtCate,
......@@ -381,7 +423,8 @@ export default {
categoryId: tmp.categoryId,
level: tmp.level,
clazzId: tmp.clazzId,
thumb: tmp.thumb,
thumb: tmp.thumb ? tmp.thumb : [],
adThumb: tmp.adThumb,
updateTime: tmp.updateTime
}
}
......
......@@ -304,6 +304,8 @@ export default {
methods: {
requestData () {
this.loading = true
this.searchContent.goodsId = this.searchContent.goodsId.replace(/\s+/g, '')
this.searchContent.goodsName = this.searchContent.goodsName.replace(/\s+/g, '')
this.api({
apiName: 'getGoodCheckList',
postdata: this.searchContent,
......@@ -315,6 +317,7 @@ export default {
return item.status === 5
})
this.totalSize = res.data.total
// console.log('111', this.totalSize)
}
})
},
......
......@@ -11,7 +11,6 @@
</div>
<div class="right">
<label class="label">地址二维码:</label>
<img :src="tokenImgData.qrUrl" alt="" @click="clickImg" style="width:40px;height:40px ">
</div>
</div>
......@@ -91,10 +90,10 @@ export default {
pageSize: 10
},
columns: [
{ title: '编号', key: 'commodityPassId', minWidth: 120, align: 'center' },
{ title: '标识名称', key: 'labelName', width: 120, align: 'center' },
{ title: '通证哈希', key: 'hash', width: 120, align: 'center' },
{ title: '绑定商品编号', key: 'goodsId', minWidth: 180, align: 'center' },
{ title: '编号', key: 'commodityPassId', minWidth: 180, align: 'left' },
{ title: '标识名称', key: 'labelName', width: 120, align: 'left' },
{ title: '通证名称', key: 'name', width: 120, align: 'center' },
{ title: '绑定商品编号', key: 'goodsId', minWidth: 180, align: 'left' },
{ title: '绑定商品名称', key: 'goodsName', minWidth: 150, align: 'center' },
{ title: '可用数量', key: 'availableNumber', minWidth: 100, align: 'center' },
{ title: '状态',
......@@ -114,8 +113,9 @@ export default {
}
},
{ title: '操作',
key: 'goodsId',
width: 200,
align: 'center',
align: 'left',
fixed: 'right',
render: (h, params) => {
let recordsBtn = h(
......@@ -147,7 +147,7 @@ export default {
style: {
margin: '5px',
// display: this.isBrand ? 'inline-block' : 'none'
display: params.row.status === 0 ? 'inline-block' : 'none'
display: (params.row.status === 0 && params.row.availableNumber>0) ? 'inline-block' : 'none'
}
},
'发布商品'
......@@ -217,6 +217,7 @@ export default {
},
handleAdd (row) {
return () => {
// console.log(row)
let query = { labelName: row.labelName, commodityPassId: row.commodityPassId, availableNumber: row.availableNumber }
this.$router.push({ name: 'commodity_add_good', query })
}
......
......@@ -421,6 +421,8 @@ export default {
},
requestData () {
this.loading = true
this.searchContent.goodsId = this.searchContent.goodsId.replace(/\s+/g, '')
this.searchContent.goodsName = this.searchContent.goodsName.replace(/\s+/g, '')
this.api({
apiName: 'getGoodsCommentList',
postdata: this.searchContent,
......
......@@ -9,6 +9,7 @@
style="width: 180px"
clearable
/>
<!-- .trim -->
<Input
placeholder="请输入商品名称"
class="search-input"
......@@ -28,7 +29,7 @@
v-for="(item, index) of ShopType"
:value="item"
:key="'series-option-' + index"
>{{ShopTypeObj[item].label}}</Option
>{{ ShopTypeObj[item].label }}</Option
>
</Select>
<Select
......@@ -62,13 +63,15 @@
<Icon type="md-refresh" />
</Button>
</ButtonGroup>
<Button type="info" @click="handleAdd" v-if="!platform"
>+ 添加商品</Button
>
<Button
type="info"
@click="handleAdd"
type="error"
v-if="!platform"
>+ 添加商品</Button
@click="batchDel"
style="margin-left: 10px"
>
<Button type="error" v-if="!platform" @click="batchDel" style="margin-left: 10px">
批量删除
</Button>
</div>
......@@ -141,355 +144,440 @@
</div>
</div>
</Modal>
</div>
</template>
<script>
import Tables from '_c/tables'
import { formatTime } from '@/libs/tools'
import { OffShelfType, OffShelfTypeObj, ShopType, ShopTypeObj } from '@/enums'
import Tables from "_c/tables";
import { formatTime } from "@/libs/tools";
import {
OffShelfType,
OffShelfTypeObj,
ShopType,
ShopTypeObj,
SalesTypeObj,
SalesType,
} from "@/enums";
export default {
inject: ['reload'],
inject: ["reload"],
components: {
Tables
Tables,
},
computed: {
isBrand () {
return this.$store.getters.isBrand
isBrand() {
return this.$store.getters.isBrand;
},
platform () {
return this.$store.state.admin.type == 1 || this.$store.state.admin.type == 4
platform() {
return (
this.$store.state.admin.type == 1 || this.$store.state.admin.type == 4
);
},
newColumns () {
newColumns() {
if (!this.platform) {
return this.columns.filter((item) => {
return item.key !== 'enterpriseName'
})
return item.key !== "enterpriseName";
});
} else {
return this.columns
}
return this.columns;
}
},
data () {
},
data() {
return {
OffShelfType,
OffShelfTypeObj,
ShopType,
ShopTypeObj,
SalesType,
SalesTypeObj,
searchContent: {
goodsId: '',
goodsName: '',
goodsType: '',
status: '',
addTimeHead: '',
addTimeTail: '',
goodsId: "",
goodsName: "",
goodsType: "",
status: "",
addTimeHead: "",
addTimeTail: "",
pageNum: 1,
pageSize: 10
pageSize: 10,
},
createTime: [],
seriesList: [
{
series_id: 1,
series_name: '已上架'
series_name: "已上架",
},
{
series_id: 2,
series_name: '已下架'
series_name: "已下架",
},
{
series_id: 3,
series_name: '发行中'
series_name: "发行中",
},
{
series_id: 4,
series_name: '失败'
series_name: "失败",
},
{
series_id: 5,
series_name: '待审核'
series_name: "待审核",
},
{
series_id: 6,
series_name: '已驳回'
series_name: "已驳回",
},
{
series_id: 7,
series_name: '待上架'
series_name: "待上架",
},
{
series_id: 8,
series_name: '已取消'
series_name: "已取消",
},
{
series_id: 9,
series_name: '草稿'
}
series_name: "草稿",
},
],
columns: [
{
type: 'selection',
type: "selection",
width: 60,
align: 'center'
align: "center",
},
{ title: '编号', key: 'goodsId', minWidth: 180, align: 'left' },
{ title: '名称', key: 'name', width: 180, align: 'center' },
{ title: "编号", key: "goodsId", minWidth: 180, align: "left" },
{ title: "名称", key: "name", width: 180, align: "center" },
{
title: '展示图',
key: 'thumb',
title: "商品类型",
align: "center",
width: 100,
align: 'center',
render: (h, params) => {
return h('div',
let obj = ShopTypeObj[params.row.type];
return h("span", obj.label);
},
},
// {
// title: '应用NFT',
// align: 'center',
// width: 100,
// render: (h, params) => {
// // let obj = SalesTypeObj[params.row.useNft]
// return h(
// 'span',
// (params.row.useNft == 0 ? '否' : (params.row.useNft == 1 ? '是' : '--'))
// )
// }
// },
{
title: "销售模式",
align: "center",
width: 100,
render: (h, params) => {
let obj = SalesTypeObj[params.row.salesType];
return h("span", obj ? obj.label : "--");
},
},
{
title: "展示图",
key: "thumb",
width: 100,
align: "center",
render: (h, params) => {
return h(
"div",
{
style: {
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
height: '70px'
}
display: "flex",
alignItems: "center",
justifyContent: "center",
height: "70px",
// display: params.row.thumb != '' ? 'inline-block' : 'none'
},
},
[
h('img', {
h("img", {
attrs: {
src: params.row.thumb
src: params.row.thumb,
},
style: {
width: '70px',
height: '50px',
objectFit: 'fill'
}
})
])
}
width: "70px",
height: "50px",
objectFit: "fill",
display: params.row.thumb != "" ? "inline-block" : "none",
},
{ title: '价格',
key: 'price',
}),
]
);
},
},
{
title: "价格",
key: "price",
width: 130,
align: 'center',
align: "center",
render: (h, params) => {
let minPrice = params.row.defaultPrice
let maxPrice = params.row.maxPrice
// let minPrice = params.row.defaultPrice
// let maxPrice = params.row.maxPrice
return h(
'div',
minPrice + ' -- ' + maxPrice
)
}
},
{ title: '库存量', key: 'stock', width: 100, align: 'center' },
{ title: '销售量', key: 'sales', width: 100, align: 'center' },
{ title: '商家',
key: 'enterpriseName',
"div",
params.row.section
// minPrice + ' -- ' + maxPrice
);
},
},
// { title: '库存量',
// key: 'stock',
// width: 100,
// align: 'center',
// render: (h, params) => {
// return h(
// 'div',
// params.row.stock ? params.row.stock : '--'
// )
// }
// },
{ title: "库存量", key: "stock", width: 100, align: "center" },
{ title: "销售量", key: "sales", width: 100, align: "center" },
// { title: '销售量',
// key: 'sales',
// width: 100,
// align: 'center',
// render: (h, params) => {
// return h(
// 'div',
// params.row.sales ? params.row.sales : '--'
// )
// } },
{
title: "商家",
key: "enterpriseName",
width: 150,
align: 'center',
align: "center",
render: (h, params) => {
return h('div',
return h(
"div",
{
style: {
color: '#5296ee'
}
color: "#5296ee",
},
},
[
h('Poptip', {
h(
"Poptip",
{
props: {
trigger: 'hover',
trigger: "hover",
title: `联系人:${params.row.linkName} 联系方式:${params.row.linkPhone}`,
size: 'small'
}
}, params.row.enterpriseName)
])
}
size: "small",
},
{
title: '商品类型',
align: 'center',
width: 100,
render: (h, params) => {
let obj = ShopTypeObj[params.row.type]
return h(
'span',
// {
// props: {
// color: obj.color
// }
// },
obj.label
)
}
},
params.row.enterpriseName
),
]
);
},
},
{
title: '状态',
key: 'status',
align: 'center',
title: "状态",
key: "status",
align: "center",
width: 100,
render: (h, params) => {
let obj = OffShelfTypeObj[params.row.status]
let obj = OffShelfTypeObj[params.row.status] || {};
return h(
'Tag',
"Tag",
{
props: {
color: obj.color
}
color: obj.color,
},
},
obj.label
)
}
);
},
{ title: '失败理由',
},
{
title: "失败理由",
width: 130,
align: 'center',
align: "center",
render: (h, params) => {
return h(
'div',
params.row.checkFailReason ? params.row.checkFailReason : '--'
)
}
"div",
params.row.checkFailReason ? params.row.checkFailReason : "--"
);
},
},
{
title: '入库时间',
align: 'center',
title: "入库时间",
align: "center",
width: 180,
render: (h, params) => {
return h('span', formatTime(params.row.createTime))
}
return h("span", formatTime(params.row.createTime));
},
},
{
title: '操作',
key: 'name',
align: 'left',
title: "操作",
key: "name",
align: "left",
minWidth: 180,
maxWidth: 300,
fixed: 'right',
fixed: "right",
render: (h, params) => {
let status = params.row.status
let platform = this.platform
let status = params.row.status;
let platform = this.platform;
let detailBtn = h(
'Button',
"Button",
{
props: {
type: 'primary',
size: 'small'
type: "primary",
size: "small",
},
style: {
margin: '5px'
margin: "5px",
},
on: {
click: this.handleDetail(params.row)
}
click: this.handleDetail(params.row),
},
},
'详 情'
)
"详 情"
);
let editBtn = h(
'Button',
"Button",
{
props: {
type: 'primary',
size: 'small'
type: "primary",
size: "small",
},
on: {
click: this.handleUpdate(params.row)
click: this.handleUpdate(params.row),
},
style: {
margin: '5px',
margin: "5px",
// display: this.isBrand ? 'inline-block' : 'none'
display: status == OffShelfType.SHELVES ? 'inline-block' : 'none'
}
display:
status == OffShelfType.SHELVES ? "inline-block" : "none",
},
},
'编 辑'
)
"编 辑"
);
let draftBtn = h(
'Button',
"Button",
{
props: {
type: 'primary',
size: 'small'
type: "primary",
size: "small",
},
on: {
click: this.handleDraft(params.row)
click: this.handleDraft(params.row),
},
style: {
margin: '5px',
margin: "5px",
// display: this.isBrand ? 'inline-block' : 'none'
display: (status == OffShelfType.DRAFT || status == OffShelfType.OFFERING || status == OffShelfType.CHECK_FAIL || status == OffShelfType.FAIL) ? 'inline-block' : 'none'
}
display:
status == OffShelfType.DRAFT ||
status == OffShelfType.OFFERING ||
status == OffShelfType.CHECK_FAIL ||
status == OffShelfType.FAIL
? "inline-block"
: "none",
},
'编 辑'
)
},
"编 辑"
);
let offShelfBtn = h(
'Button',
"Button",
{
props: {
type: status == OffShelfType.SHELVES ? 'primary' : 'primary',
size: 'small'
type: status == OffShelfType.SHELVES ? "primary" : "primary",
size: "small",
},
on: {
click: this.handleOffShelf(params.row)
click: this.handleOffShelf(params.row),
},
style: {
margin: '5px',
display: ((status == OffShelfType.OFFERING || status == OffShelfType.SHELVES|| status == OffShelfType.PREHEAT) && !platform) || status == OffShelfType.GROUNDING ? 'inline-block' : 'none'
}
},
status == OffShelfType.OFFERING || status == OffShelfType.SHELVES ? '上 架' : '下 架'
)
margin: "5px",
display:
((status == OffShelfType.OFFERING ||
status == OffShelfType.SHELVES ||
status == OffShelfType.PREHEAT) &&
!platform) ||
status == OffShelfType.GROUNDING
? "inline-block"
: "none",
},
},
status == OffShelfType.OFFERING || status == OffShelfType.SHELVES
? "上 架"
: "下 架"
);
let delBtn = h(
'Button',
"Button",
{
props: {
type: 'error',
size: 'small'
type: "error",
size: "small",
},
on: {
click: this.handleDel(params.row)
click: this.handleDel(params.row),
},
style: {
margin: '5px',
display: status == OffShelfType.OFFERING || status == OffShelfType.CHECK_FAIL || status == OffShelfType.CANCELED ? 'inline-block' : 'none'
}
margin: "5px",
display:
status == OffShelfType.SHELVES ||
status == OffShelfType.CANCELED
? "inline-block"
: "none",
},
},
'删 除'
)
"删 除"
);
let cancelBtn = h(
'Button',
"Button",
{
props: {
type: 'primary',
size: 'small'
type: "primary",
size: "small",
},
on: {
click: this.handleCancel(params.row)
click: this.handleCancel(params.row),
},
style: {
margin: '5px',
display: status == OffShelfType.AUDIT ? 'inline-block' : 'none'
}
margin: "5px",
display:
status == OffShelfType.AUDIT ? "inline-block" : "none",
},
'取 消'
)
let againBtn = h(
'Button',
},
"取 消"
);
let withdrawBtn = h(
"Button",
{
props: {
type: 'primary',
size: 'small'
type: "primary",
size: "small",
},
on: {
click: this.handleAgain(params.row)
click: this.handleWithdraw(params.row),
},
style: {
margin: '5px',
display: status == OffShelfType.FAIL || status == OffShelfType.CHECK_FAIL || status == OffShelfType.CANCELED ? 'inline-block' : 'none'
}
margin: "5px",
display:
status == OffShelfType.AUDIT ? "inline-block" : "none",
},
},
"撤 回"
);
return h("div", [
detailBtn,
!this.platform && editBtn,
offShelfBtn,
!this.platform && cancelBtn,
!this.platform && delBtn,
!this.platform && draftBtn,
!this.platform && withdrawBtn,
]);
},
},
'重新发布'
)
return h('div', [detailBtn, !this.platform && editBtn, offShelfBtn, !this.platform && cancelBtn, !this.platform && againBtn, !this.platform && draftBtn, !this.platform && delBtn])
}
}
],
tableData: [],
totalSize: 0,
......@@ -507,31 +595,42 @@ export default {
name: "",
date: "",
},
}
optionsDate: {
disabledDate(date) {
return date && date.valueOf() < Date.now() - 86400000;
},
},
};
},
methods: {
requestData () {
this.loading = true
requestData() {
this.loading = true;
this.searchContent.goodsId = this.searchContent.goodsId.replace(
/\s+/g,
""
);
this.searchContent.goodsName = this.searchContent.goodsName.replace(
/\s+/g,
""
);
this.api({
apiName: 'getGoodList',
apiName: "getGoodList",
postdata: this.searchContent,
complete: () => {
this.loading = false
this.loading = false;
},
success: (res) => {
this.tableData = res.data.records
this.totalSize = res.data.total
if (this.tableData.length > 0) {
for (let i = 0; i < this.tableData.length; i++) {
if (this.tableData[i].status != 8 && this.tableData[i].status != 7) {
this.tableData[i]._disabled = true
this.tableData = res.data.records;
this.totalSize = res.data.total;
this.tableData.forEach((item) => {
if (item.status != 2 && item.status != 8) {
item._disabled = true;
}
}
}
}
})
});
},
});
},
requestSeries () {
requestSeries() {
// this.api({
// apiName: 'getSeriesList',
// success: (res) => {
......@@ -539,134 +638,183 @@ export default {
// }
// })
},
handleSearch () {
this.searchContent.pageNum = 1
this.requestData()
handleSearch() {
this.searchContent.pageNum = 1;
this.requestData();
},
handleRefresh () {
this.reload()
handleRefresh() {
this.reload();
},
handleDel (row) {
handleDel(row) {
return () => {
this.$Modal.confirm({
title: '删除',
title: "删除",
content: `您确认要删除名称为${row.name} 的商品?`,
onOk: () => {
this.api({
apiName: 'deleteGood',
apiName: "deleteGood",
postdata: [row.goodsId],
success: () => {
this.requestData()
this.$Notice.success({ title: `操作成功!` })
}
})
}
})
}
this.requestData();
this.$Notice.success({ title: `操作成功!` });
},
batchDel () {
});
},
});
};
},
batchDel() {
if (this.selectCount <= 0) {
this.$Message.warning('您还未选择要删除的数据')
return false
this.$Message.warning("您还未选择要删除的数据");
return false;
}
let goodsIds = this.selectList
let goodsIds = this.selectList;
this.$Modal.confirm({
title: '删除',
title: "删除",
content: `您确认要删除所选的 ${this.selectCount}条数据?`,
onOk: () => {
this.api({
apiName: 'deleteGood',
apiName: "deleteGood",
postdata: goodsIds,
success: () => {
this.requestData()
this.$Notice.success({ title: `操作成功!` })
}
})
}
})
this.requestData();
this.$Notice.success({ title: `操作成功!` });
},
});
},
handleCurrentChange (pageNum) {
this.searchContent.pageNum = pageNum
this.requestData()
});
},
changeSelect (e) {
this.selectList = e.map(item => {
return item.goodsId
})
this.selectCount = e.length
handleCurrentChange(pageNum) {
this.searchContent.pageNum = pageNum;
this.requestData();
},
handleDateChange (createTime) {
if (createTime && createTime.length == 2 && createTime[0] && createTime[1]) {
this.searchContent.addTimeHead = new Date(createTime[0]).getTime()
changeSelect(e) {
this.selectList = e.map((item) => {
return item.goodsId;
});
this.selectCount = e.length;
},
handleDateChange(createTime) {
if (
createTime &&
createTime.length == 2 &&
createTime[0] &&
createTime[1]
) {
this.searchContent.addTimeHead = new Date(createTime[0]).getTime();
this.searchContent.addTimeTail =
new Date(createTime[1]).getTime() + 24 * 60 * 60 * 1000 - 1
new Date(createTime[1]).getTime() + 24 * 60 * 60 * 1000 - 1;
} else {
this.searchContent.addTimeHead = ''
this.searchContent.addTimeTail = ''
this.searchContent.addTimeHead = "";
this.searchContent.addTimeTail = "";
}
},
handleAdd () {
this.$router.push({ name: 'add_good' })
handleAdd() {
this.$router.push({ name: "add_good" });
},
handleUpdate (row) {
handleUpdate(row) {
return () => {
let query = { goodsId: row.goodsId }
this.$router.push({ name: row.commodityPass == 3 ? 'commodity_update_good' : 'update_good', query })
}
let query = { goodsId: row.goodsId };
this.$router.push({
name:
row.commodityPass == 3 ? "commodity_update_good" : "update_good",
query,
});
};
},
handleAgain (row) {
handleDraft(row) {
return () => {
let query = { goodsId: row.goodsId }
this.$router.push({ name: row.commodityPass == 3 ? 'commodity_again_good' : 'again_good', query })
}
let query = { goodsId: row.goodsId };
this.$router.push({
name: row.commodityPass == 3 ? "commodity_draft_good" : "draft_good",
query,
});
};
},
handleDraft (row) {
handleWithdraw(row) {
return () => {
console.log(row)
let query = { goodsId: row.goodsId }
this.$router.push({ name: row.commodityPass == 3 ? 'commodity_draft_good' : 'draft_good', query })
}
let goodsId = row.goodsId;
this.$Modal.confirm({
content: `确认要撤回审核名称为 ${row.name} 的商品 ?`,
onOk: () => {
this.api({
apiName: "withdrawGood",
postdata: goodsId,
success: () => {
this.requestData();
this.$Notice.success({ title: `撤回成功!` });
},
});
},
handleDetail (row) {
});
};
},
handleDetail(row) {
return () => {
let query = { goodsId: row.goodsId }
this.$router.push({ name: row.commodityPass == 3 ? 'commodity_good_detail' : 'good_detail', query })
}
let query = { goodsId: row.goodsId };
this.$router.push({
name:
row.commodityPass == 3 ? "commodity_good_detail" : "good_detail",
query,
});
};
},
handleOffShelf (row) {
handleOffShelf(row) {
return () => {
let goodsId = row.goodsId
let type = row.status == OffShelfType.OFFERING || row.status == OffShelfType.SHELVES ? OffShelfType.GROUNDING : OffShelfType.SHELVES
let title = row.status == OffShelfType.OFFERING || row.status == OffShelfType.SHELVES ? '上架' : '下架'
let goodsId = row.goodsId;
let type =
row.status == OffShelfType.OFFERING ||
row.status == OffShelfType.SHELVES
? OffShelfType.GROUNDING
: OffShelfType.SHELVES;
let title =
row.status == OffShelfType.OFFERING ||
row.status == OffShelfType.SHELVES
? "上架"
: "下架";
let salesType = row.salesType;
if (salesType === 1|| salesType === 4) {
this.OffShelfModal(
goodsId,
type,
title,
row.name,
row.preheatEndTime,
row.status
);
} else {
this.$Modal.confirm({
title,
content: `确认要${title}名称为 ${row.name} 的商品 ?`,
onOk: () => {
this.api({
apiName: "onOffSeries",
postdata: { goodsId, type, title },
success: () => {
this.requestData();
this.$Notice.success({ title: `操作成功!` });
},
});
},
});
}
};
},
OffShelfModal(goodsId, type, title, name, preheatEndTime = 0, status) {
this.formData = {
title,
goodsId,
type,
preheatEndTime: "",
name:row.name,
name,
};
if (row.preheatEndTime && row.status === 10) {
let date = formatTime(row.preheatEndTime, "yyyy-MM-dd hh:mm");
if (preheatEndTime && status === 10) {
let date = formatTime(preheatEndTime, "yyyy-MM-dd hh:mm");
this.formData.preheatEndTime = date;
this.formData.date = new Date(row.preheatEndTime);
this.formData.date = new Date(preheatEndTime);
}
this.detailModal = true;
// this.$Modal.confirm({
// title,
// content: `确认要${title}名称为 ${row.name} 的商品 ?`,
// onOk: () => {
// this.api({
// apiName: 'onOffSeries',
// postdata: { goodsId, type },
// success: () => {
// this.requestData()
// this.$Notice.success({ title: `操作成功!` })
// }
// })
// }
// })
}
},
OffShelfModalOk() {
if (this.formData.type === 10) {
......@@ -713,23 +861,23 @@ export default {
});
}
},
handleCancel (row) {
handleCancel(row) {
return () => {
let goodsId = row.goodsId
let goodsId = row.goodsId;
this.$Modal.confirm({
content: `确认要取消审核名称为 ${row.name} 的商品 ?`,
onOk: () => {
this.api({
apiName: 'cancelCheckGood',
apiName: "cancelCheckGood",
postdata: goodsId,
success: () => {
this.requestData()
this.$Notice.success({ title: `取消成功!` })
}
})
}
})
}
this.requestData();
this.$Notice.success({ title: `取消成功!` });
},
});
},
});
};
},
changeFormDataDate(val) {
console.log(val);
......@@ -737,19 +885,19 @@ export default {
console.log(this.formData);
// this.formData.date = val;
},
handleRecommend (row) {
handleRecommend(row) {
// return () => {}
}
},
created () {
console.log(this.type)
},
created() {
console.log(this.type);
// if (!this.isBrand) {
// this.columns.splice(2, 0, { title: '品牌方', key: 'brandName', width: 150, align: 'center' })
// }
this.requestData()
this.requestData();
// this.requestSeries()
}
}
},
};
</script>
<style lang="less">
......@@ -774,4 +922,18 @@ export default {
}
}
}
.OffShelfModal {
.form-content {
.flex-between {
display: flex;
justify-content: center;
padding-top: 20px;
.ivu-form {
.ivu-form-item {
margin-bottom: 0;
}
}
}
}
}
</style>
<template>
<div class="add-help-page">
<Card v-if="loading" class="loading-card">
<Spin fix size="large" />
</Card>
<Card v-else class="main_card">
<div class="main_info">
<div class="head">
<Icon type="md-bookmark" color="#2d8cf0" :size="28" />
<label>{{ title }}</label>
</div>
<div class="item">
<label class="label">类目:</label>
<Select
placeholder="请选择类目"
v-model="saveDTO.helpCategoryId"
style="width: 400px;"
>
<Option v-for="item in categoryList" :value="item.helpCategoryId" :key="item.helpCategoryId">{{item.name}}</Option>
</Select>
<Button
type="primary"
@click="btnSelect"
style="margin-left:20px;"
>添加</Button
>
</div>
<div class="item">
<label class="label">标题:</label>
<Input
placeholder="请填写帮助标题,20字以内"
v-model="saveDTO.title"
:maxlength="20"
style="width: 400px"
/>
</div>
<div class="item">
<label class="label">详情描述:</label>
<div class="editor-con">
<Spin fix v-if="editorLoading">
<Icon type="ios-loading" size="30" color="#2d8cf0" class="spin-icon-load"></Icon>
<div>上传中( {{editorUploadPercent}}% )...</div>
</Spin>
<quill-editor
v-model="saveDTO.detail"
ref="myQuillEditor"
:options="editorOption"
class="detail-editor"
></quill-editor>
</div>
</div>
<Upload
:action="uploadImgUrl"
ref="uploadImg"
v-show="false"
:headers="{token: $store.state.admin.token, adminId: $store.state.admin.uid}"
:before-upload="imgBoforeUpload"
:on-progress="uploadOnProgress"
:on-success="imgUploadSuccess"
:on-error="imgUploadErr"
accept=".jpg, .jpeg, .png, .gif"
/>
<Upload
:action="uploadVideoUrl"
ref="uploadVideo"
v-show="false"
:headers="{token: $store.state.admin.token, adminId: $store.state.admin.uid}"
:before-upload="videoBoforeUpload"
:on-progress="uploadOnProgress"
:on-success="videoUploadSuccess"
:on-error="videoUploadErr"
accept=".mp4, .mkv"
/>
<div class="footer-con">
<Button
type="default"
@click="handleCancel"
style="margin-right: 30px"
>取消</Button
>
<Button
type="primary"
@click="handleSubmit"
>确定</Button
>
</div>
</div>
</Card>
<Modal
title="添加类目"
v-model="isAddCategory"
@on-cancel="cancelCategory"
>
<div class="model-item">
<Input v-model="name" placeholder="请输入类目名称"/>
</div>
<div slot="footer">
<Button
type="primary"
@click="handleCategory"
>
确定
</Button>
</div>
</Modal>
</div>
</template>
<script>
import Tables from '_c/tables'
import { mapMutations } from 'vuex'
import { formatTime, getPosterFromVideoUrl } from '@/libs/tools'
import { uploadImgUrl, uploadVideoUrl } from '@/api/apiConfig'
import { apiVerify } from '@/api/apiVerify'
export default {
name: 'add-coupon',
components: {
Tables
},
computed: {
title () {
if (this.routeName === 'edit_help') {
return '编辑帮助'
} else {
return '新建帮助'
}
},
isAdd () {
return this.routeName === 'add_help'
},
isEdit () {
return this.routeName === 'edit_help'
},
platform () {
return this.$store.state.admin.type == 1 || this.$store.state.admin.type == 4
},
editor () {
return this.$refs.myQuillEditor.quill
}
},
data () {
return {
routeName: '',
loading: false,
isAddCategory: false,
skuList: [],
saveDTO: {
detail: '', // 详细
helpCategoryId: '', // 类目编号
title: '' // 帮助标题
},
name: '', // 类目名称
categoryList: [],
uploadImgUrl,
uploadVideoUrl,
editorOption: {
placeholder: '请输入内容...',
modules: {
toolbar: [
[
'bold',
'italic',
{ header: 2 },
'blockquote',
{ list: 'ordered' },
{ list: 'bullet' },
{ align: [] }
],
['image', 'video']
]
}
},
editorLoading: false,
editorUploadPercent: 0
}
},
mounted () {
this.initData()
this.categoryInfo()
this.editor.getModule('toolbar').addHandler('image', this.imgHandler)
this.editor.getModule('toolbar').addHandler('video', this.videoHandler)
},
methods: {
...mapMutations(['closeTag']),
requestBannerDetail (infoId) {
this.api({
apiName: 'searchInfoId',
postdata: infoId,
success: (res) => {
this.saveDTO = res.data
}
})
},
initData () {
let routeName = this.$route.name
console.log(routeName)
let infoId = this.$route.query.infoId
this.routeName = routeName
if (routeName == 'edit_help') {
this.requestBannerDetail(infoId)
} else {
this.loading = false
}
},
handleCancel () {
let title = '已取消'
let route = this.$route
let toRouteName = 'help_page'
this.closeTag({ route, toRouteName })
this.$Notice.success({ title })
},
handleSubmit () {
let { saveDTO } = this
if (saveDTO.helpCategoryId == '') {
return this.$Notice.warning({ title: '请选择类目名称!' })
}
if (saveDTO.title == '') {
return this.$Notice.warning({ title: '请输入类目标题!' })
}
if (saveDTO.detail == '') {
return this.$Notice.warning({ title: '请输入详情描述!' })
}
let apiName = this.isAdd ? 'addHelp' : 'updateHelp'
let title = this.isAdd ? '添加成功!' : '编辑成功!'
this.api({
apiName,
postdata: saveDTO,
success: (res) => {
// 关闭当前标签页
let route = this.$route
let toRouteName = 'help_page'
this.closeTag({ route, toRouteName })
this.$Notice.success({ title })
}
})
},
btnSelect () {
this.isAddCategory = true
},
handleCategory () {
let { name } = this
if (!name) {
this.$Notice.warning({ title: '请输入类目名称!' })
return
}
let saveDTO = {
name
}
this.api({
apiName: 'addCategory',
postdata: saveDTO,
complete: () => {
this.isAddCategory = false
},
success: (res) => {
this.categoryInfo()
this.name = ''
this.$Notice.success({ title: `添加成功!` })
}
})
},
cancelCategory () {
this.name = ''
},
categoryInfo () {
this.api({
apiName: 'helpCategoryList',
postdata: this.category,
complete: () => {
// this.loading = false
},
success: (res) => {
this.categoryList = res.data.records
}
})
},
imgHandler (image) {
if (image) {
this.$refs.uploadImg.$el.querySelector('[type=file]').click()
}
},
videoHandler (video) {
if (video) {
this.$refs.uploadVideo.$el.querySelector('[type=file]').click()
}
},
uploadOnProgress (event, file, fileList) {
this.editorUploadPercent = parseFloat(event.percent).toFixed(1)
},
imgBoforeUpload (file) {
if (file.size >= 5 * 1024 * 1024) {
this.$Notice.warning({ title: '上传图片不得超过5MB!' })
return false
}
this.editorUploadPercent = 0
this.editorLoading = true
},
imgUploadSuccess (res, file, fileList) {
this.editorLoading = false
apiVerify({
res: { data: res },
success: () => {
let url = res.data
let addImageRange = this.editor.getSelection()
let newRange = 0 + (addImageRange !== null ? addImageRange.index : 0)
this.editor.insertEmbed(newRange, 'simpleImg', {
url,
width: '60%',
marginLeft: '50%',
transform: 'translate(-50%)'
})
this.editor.setSelection(1 + newRange)
}
})
},
imgUploadErr () {
this.editorLoading = false
this.$Notice.error({ title: '上传失败,请稍后再试!' })
},
videoBoforeUpload (file) {
if (file.size >= 50 * 1024 * 1024) {
this.$Notice.warning({ title: '上传视频不得超过50MB!' })
return false
}
this.editorUploadPercent = 0
this.editorLoading = true
},
videoUploadSuccess (res, file, fileList) {
this.editorLoading = false
apiVerify({
res: { data: res },
success: () => {
let url = res.data
let addVideoRange = this.editor.getSelection()
let newRange = 0 + (addVideoRange !== null ? addVideoRange.index : 0)
this.editor.insertEmbed(newRange, 'simpleVideo', {
url,
controls: 'controls',
width: '60%',
marginLeft: '50%',
transform: 'translate(-50%)',
poster: getPosterFromVideoUrl(url)
})
this.editor.setSelection(1 + newRange)
}
})
},
videoUploadErr () {
this.editorLoading = false
this.$Notice.error({ title: '上传失败,请稍后再试!' })
}
}
}
</script>
<style scoped lang="less">
.add-help-page {
height: 100%;
min-width: 1000px;
// position: relative;
.loading-card {
height: 100%;
}
.main_card{
overflow: hidden;
.main_info{
.head {
color: #17233d;
font-size: 18px;
font-weight: bold;
display: flex;
align-items: center;
margin-bottom: 15px;
i {
margin-right: 10px;
}
}
.item {
display: flex;
align-items: center;
margin-bottom: 20px;
}
.item .label {
display: block;
width: 200px;
text-align: right;
}
.item .editor-con {
position: relative;
width: 600px;
.spin-icon-load {
animation: ani-demo-spin 1s linear infinite;
}
.ivu-spin {
border: 1px solid #dcdee2;
border-radius: 5px;
}
.describt-detail{
width: 100%;
height: 800px;
overflow-y: auto;
padding: 10px;
border: 1px solid #dcdee2;
border-radius: 5px;
}
.detail-editor {
/deep/ .ql-toolbar {
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
/deep/ .ql-container {
height: 800px;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}
}
}
.footer-con {
width: 600px;
display: flex;
justify-content:space-around;
// padding: 30px 200px;
margin-left: 200px;
}
}
}
}
</style>
<template>
<li style="list-style-type:none;">
<div class="operation-main-title">
<h3 class="info-title">{{infoDetail.title}}</h3>
<div class="btn" >
<Button type="primary" @click="updateHelp(infoDetail.infoId)" v-if="platform" style="margin-right:10px;">编辑</Button>
<Button type="error" @click="detaleHelp(infoDetail.infoId)" v-if="platform"> 删除</Button>
</div>
</div>
<div
:class="[isHide ? 'operation-main-info' : '']">
<p v-html="infoDetail.detail"></p>
</div>
<div style="text-align:right;margin:20px 0">
<Button v-if="isHide" @click="isOpen()">展开</Button>
<Button v-if="!isHide" @click="isPutaway()">收起</Button>
</div>
</li>
</template>
<script>
export default {
props: {
infoDetail: {
type: Object
}
// isHide: {
// type: Boolean,
// default: true
// }
},
data () {
return {
isHide: true
}
},
computed:{
platform () {
return this.$store.state.admin.type == 1 ||this.$store.state.admin.type == 4
}
},
methods: {
isOpen () {
this.isHide = false
},
isPutaway () {
this.isHide = true
},
updateHelp (infoId) {
let query = { infoId: infoId }
this.$router.push({ name: 'edit_help', query })
},
detaleHelp (infoId) {
// this.api({
// apiName: 'deleteInfoId',
// postdata: infoId,
// complete: () => {
// // this.loading = false
// },
// success: (res) => {
// this.listInfo()
// }
// })
this.$Modal.confirm({
title: '提示',
content: `您确定删除 “${this.infoDetail.title}” 吗?`,
onOk: () => {
this.api({
apiName: 'deleteInfoId',
postdata: infoId,
success: (res) => {
console.log('res', res)
this.$Message.info('删除成功')
this.$emit('listInfo')
}
})
},
onCancel: () => {
this.$Message.info('取消')
}
})
}
}
}
</script>
<style scoped lang="less">
.operation-main-title{
margin: 20px 0;
width: 100%;
display: flex;
justify-content:space-between;
.info-title{
font-size: 25px;
line-height: 30px;
font-weight:800;
}
// .btn{
// width: 28%;
// display: flex;
// justify-content:space-between;
// }
}
.operation-main-info{
width: 100%;
word-break: break-all;
overflow: hidden;
white-space:normal;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 4;
height: 80px;
}
</style>
<template>
<div class="help-info">
<Card v-if="helpCategoryNameList.length==0" class="help-tips">
<p class="tips-info">暂无数据~</p>
</Card>
<Card v-else style="min-height:90%">
<div style="text-align:center;margin:20px 0">
<Input v-model="keyWord" placeholder="请输入检索关键字" style="width: 400px" search @on-search="searchHelpInfo"/>
</div>
<div class="main-page">
<Row>
<Col span="8">
<Menu :theme="theme2"
:active-name="helpCategoryNameList[0].infoList[0].infoId"
:open-names="[helpCategoryNameList[0].helpCategoryName]"
@on-select="changeMenu"
>
<Submenu
:name="name_item.helpCategoryName"
v-for="(name_item,i) in helpCategoryNameList"
:key="i">
<template slot="title">
{{name_item.helpCategoryName}}
</template>
<MenuItem
:name="title_item.infoId"
v-for="(title_item,i) in name_item.infoList"
:key="i"
>{{title_item.title}}</MenuItem>
</Submenu>
</Menu>
</Col>
</Row>
<br>
<div class="operation-info">
<ul v-for="(item_detail,i) in detilList" :key="i">
<help-info :infoDetail="item_detail" @listInfo="listInfo"></help-info>
</ul>
</div>
</div>
</Card>
</div>
</template>
<script>
import HelpInfo from './help-info'
export default {
components: {
HelpInfo
},
data () {
return {
theme2: 'light',
category: {
pageNum: '',
pageSize: ''
},
keyWord: '',
helpCategoryNameList: [],
titleList: [],
detilList: [],
isHide: true
}
},
methods: {
searchHelpInfo () {
let { keyWord } = this
this.detilList = []
this.api({
apiName: 'helpInfoList',
postdata: { keyWord },
complete: () => {
this.loading = false
},
success: (res) => {
res.data.forEach(item => {
item.infoList.forEach(itemb => {
this.detilList.push(itemb)
})
})
}
})
},
changeMenu (infoId) {
this.detilList = []
this.api({
apiName: 'searchInfoId',
postdata: infoId,
success: (res) => {
this.detilList.push(res.data)
}
})
},
listInfo () {
this.detilList = []
this.api({
apiName: 'helpInfoList',
postdata: this.keyWord,
complete: () => {
// this.loading = false
},
success: (res) => {
if (res.data.length != 0) {
this.helpCategoryNameList = res.data
this.detilList.push(res.data[0].infoList[0])
}
}
})
}
},
created () {
this.listInfo()
}
}
</script>
<style scoped lang="less">
.help-info{
width: 100%;
height:100%;
position: relative;
.help-tips{
min-height:90%;
.tips-info{
font-size: 25px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
}
.main-page{
width: 100%;
display: flex;
// justify-content:space-around;
.operation-info{
width: 60%;
.operation-main-title{
margin: 20px 0;
width: 100%;
display: flex;
justify-content:space-between;
.info-title{
font-size: 25px;
line-height: 30px;
font-weight:800;
}
// .btn{
// width: 28%;
// display: flex;
// justify-content:space-between;
// }
}
}
.operation-main-info{
width: 100%;
word-break: break-all;
overflow: hidden;
white-space:normal;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 4;
height: 80px;
}
}
}
</style>
......@@ -49,7 +49,7 @@ module.exports = {
// target: 'http://172.22.17.174:8088'
// target: 'http://172.22.17.108:8088'
target: 'https://testadminym.8n.cn/root'
target: 'https://testadminslg.8n.cn/root'
},
'/contact': {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment