Commit 3d5918c8 authored by 王伟's avatar 王伟

发布商品

parent d23b951c
......@@ -9,16 +9,15 @@
<label>{{ title }}</label>
</div>
<base-info :data="form.baseInfo" :isDetail="isDetail" :isEdit="isEdit" :isAgain="isAgain"/>
<!-- <sale-info
<decipt-info :data="form.deciptInfo" :isDetail="isDetail" :status="status"/>
<sale-info
:data="form.saleInfo"
:isDetail="isDetail"
:isEdit="isEdit"
:isAgain="isAgain"
:isSelf="isSelf"
:status="status"
v-if="form.baseInfo.type!=6 && form.baseInfo.type!=5"
/> -->
<decipt-info :data="form.deciptInfo" :isDetail="isDetail" :status="status"/>
/>
<info-con title="资源信息" class="base-info-con" v-if="form.baseInfo.type==5">
<div class="series-info">
<label class="label">打包价格:</label>
......@@ -91,7 +90,7 @@
<Input v-model="form.packageDTO.stock" :disabled='isDetail' placeholder="请输入库存" style="width: 400px" @on-blur="stockBlur(form.packageDTO.stock)"/>
</div>
</info-con>
<info-con title="规格信息" class="base-info-con" v-if="form.baseInfo.type==6">
<!-- <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" />
......@@ -133,7 +132,7 @@
>
</Select>
</div>
</info-con>
</info-con> -->
<info-con title="销售信息:" class="base-info-con">
<div class="series-info" v-if="(form.baseInfo.type==1||form.baseInfo.type==3)&&form.saleInfo.commodityPass!=0">
<label class="label">是否允许延后提货:</label>
......@@ -308,7 +307,13 @@ export default {
saleInfo: {
sku: [],
imgObj: {},
commodityPass: ''
commodityPass: '',
number: '', // 发行数量:只有商户选择“可拷贝”时,才会出现
price: '', // 商品价格
type: '', // NFT类型(1.单个,不可考贝 2.可拷贝)
tzType: '', // 1.内部发行 2.外部绑定
tokenId: '', // 绑定的外部通证id
salesType: ''// 销售模式
// statu:this.status
},
deciptInfo: {
......@@ -355,7 +360,6 @@ export default {
tzType: '', // 1.内部发行 2.外部绑定
tokenId: '' // 绑定的外部通证id
}
},
skuNumber: '',
loading: true,
......@@ -1096,7 +1100,7 @@ export default {
},
mounted () {
this.getNftList()
// this.getNftList()
this.requestOptionData()
this.initData()
this.getDelayDelivery()
......
<template>
<info-con title="规格信息:" class="sale-info-con">
<div
<!-- <div
class="item"
v-for="(pItem, pIndex) of propList"
:key="'prop-item-' + pIndex"
......@@ -56,30 +56,78 @@
@click="delProp(pIndex)"
v-if="!isDetail && !isEdit"
/>
</div>
<div class="item">
</div> -->
<!-- <div class="item">
<div class="empty" />
<div class="opt-btn" v-if="!isDetail && !isEdit">
<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">
<Radio :label="1" style="width:200px" :disabled="isDetail || isEdit">普通</Radio>
<Radio :label="2" style="width:200px" :disabled="isDetail || isEdit">盲盒</Radio>
</RadioGroup>
</div>
<div class="item">
<label class="label">商品价格:</label>
<Input v-model="data.price" :readonly="isDetail" placeholder="请输入商品价格" style="width: 400px" />
</div>
<div class="item">
<label class="label">商品通证:</label>
<RadioGroup v-model="data.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="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>
<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>
<Input v-model="data.number" :readonly="isDetail||isEdit||isAgain" placeholder="请输入发行数量,正整数" style="width: 400px" />
</div>
<div class="item" v-if="data.tzType==2">
<label class="label">绑定NFT:</label>
<Input v-model="data.tokenId" v-if="isDetail||isEdit||isAgain" :readonly="isDetail||isEdit||isAgain" style="width: 400px" />
<Select
v-else
placeholder="请选择NFT TOKENID"
transfer
v-model="data.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>
<!-- <div class="item">
<label class="label">商品通证:</label>
<RadioGroup v-model="data.commodityPass">
<!-- <Radio :label="0" style="width:200px" :disabled="isDetail || isEdit"></Radio> -->
<Radio :label="0" style="width:200px" :disabled="isDetail || isEdit"></Radio>
<Radio :label="1" style="width:200px" :disabled="isDetail || isEdit">是,自动生成Token</Radio>
<Radio :label="2" style="width:200px" :disabled="isDetail || isEdit">是,使用外部既有Token</Radio>
</RadioGroup>
</div>
</div> -->
<div class="item" style="text-align:center">
<Button type="primary" style="margin:auto" @click="genSkuTable">生成价目表</Button>
</div>
<div class="tip" v-if="!isDetail && !isEdit">
<!-- <div class="tip" v-if="!isDetail && !isEdit">
提示:如修改上述基本属性后,需重新生成价目表!缩略图建议尺寸100 *
100,大小不得超过6MB
</div>
</div> -->
<Table v-if="showTable" border :columns="columns" :data="data.sku">
<template slot-scope="{ row, index }" slot="originalPrice">
<span v-if="isDetail">{{ row.originalPrice }}</span>
......@@ -176,24 +224,28 @@
<Button type="error" size="small" @click="delSku(index)">删除</Button>
</template>
</Table>
<div class="item" style="margin-top:40px;">
<label class="label">难度系数:</label>
<Slider v-model="value" :tip-format="format" style="width:500px;"></Slider>
</div>
</info-con>
</template>
<script>
import InfoCon from './info-con'
import FileUpload from '_c/file-upload'
import config from '@/config'
import axios from 'axios'
const baseUrl =
process.env.NODE_ENV === 'development'
? config.baseUrl.dev
: config.baseUrl.pro
export default {
props: {
data: {
type: Object,
// type: Object,
default: { sku: [] },
commodityPass: ''
commodityPass: '',
number: '', // 发行数量:只有商户选择“可拷贝”时,才会出现
price: '', // 商品价格
type: '', // NFT类型(1.单个,不可考贝 2.可拷贝)
tzType: '', // 1.内部发行 2.外部绑定
tokenId: '', // 绑定的外部通证id
salesType: ''// 销售模式
},
isDetail: {
type: Boolean,
......@@ -203,10 +255,6 @@ export default {
type: Boolean,
default: false
},
// isSelf: {
// type: Boolean,
// default: false
// },
isAgain: {
type: Boolean,
default: false
......@@ -229,8 +277,10 @@ export default {
}],
name: '',
tokenNumber: '',
numberStock: ''
// rateList: [3, 4, 5, 6, 9, 10, 11, 13]
numberStock: '',
// rateList: [3, 4, 5, 6, 9, 10, 11, 13],
value: 3,
nftList: []
}
},
computed: {
......@@ -241,6 +291,7 @@ export default {
mounted () {
this.genPropList(this.data.sku)
this.genColumn()
this.getNftList()
if (!this.platform) {
this.getMerchantPrefixInfo()
}
......@@ -262,6 +313,27 @@ export default {
})
},
methods: {
changeTzType () {
this.data.type = ''
this.data.number = ''
this.data.tokenId = ''
},
changeType () {
this.data.number = ''
},
getNftList () {
// 获取外部NFT
this.api({
apiName: 'externnftlist',
success: (res) => {
// console.log('333', this.nftList)
this.nftList = res.data
}
})
},
format (val) {
return '难度系数: ' + val + '%'
},
getMoreParams (val, index) {
val = JSON.parse(val)
this.tokenNumber = val.availableNumber
......@@ -342,36 +414,6 @@ export default {
delSku (index) {
this.data.sku.splice(index, 1)
},
exportCer (row) {
if (row.stock == 0) {
return this.$Notice.warning({ title: '当前库存为0,无法导出!' })
}
let skuId = row.skuId
axios({
method: 'GET',
url: `${baseUrl}/goods/exportCert`,
params: { skuId },
responseType: 'blob'
}).then((res) => {
let content = res.data
let blob = new Blob([content])
let fileName = 'test.xls'
if ('download' in document.createElement('a')) {
let link = document.createElement('a')
link.download = fileName
link.style.display = 'none'
link.href = URL.createObjectURL(blob)
document.body.appendChild(link)
link.click()
URL.revokeObjectURL(link.href)
document.body.removeChild(link)
} else {
navigator.msSaveBlob(blob, fileName)
}
})
},
genPropList (sku) {
if (sku && sku.length !== 0) {
let propHashTable = {}
......@@ -401,83 +443,83 @@ export default {
},
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
}
}
}
})
// 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: '请先选择商品通证' })
}
this.genColumn()
this.genSku()
this.showTable = 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: '请先选择商品通证' })
// }
this.genColumn()
this.genSku()
this.showTable = true
// }
},
genColumn () {
let columns = []
this.propList.forEach((pItem) => {
columns.push({
title: pItem.name,
title: '规格名称',
minWidth: 120,
key: pItem.name,
slot: 'name',
align: 'center'
})
})
......
......@@ -45,11 +45,9 @@ module.exports = {
pathRewrite: {
'^/root': '/'
},
// target: 'http://146.56.197.85:12023',
// target: 'http://172.22.17.174:8088'
target: 'http://172.22.17.108:8088'
// target: 'http://10.144.38.159:8088'
// target: 'http://10.144.156.186:8088'
target: 'http://172.22.17.174:8088'
// target: 'http://172.22.17.108:8088'
},
'/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