Commit 94928da8 authored by yaya's avatar yaya

feat:钱币设置逻辑处理

parent c1329ae4
...@@ -26,8 +26,8 @@ export function publishGoods(data) { ...@@ -26,8 +26,8 @@ export function publishGoods(data) {
export function detailGoods(id) { export function detailGoods(id) {
return request({ return request({
url: '/item/findDetail', url: '/goods/detail',
method: 'post', method: 'get',
params: { id } params: { id }
}) })
} }
......
import request from '@/utils/request'
export function detailGoods(params) {
return request({
url: '/item/findDetail',
method: 'post',
data: params
})
}
export function editGoods(params) {
return request({
url: '/item/setCoin',
method: 'post',
data: params
})
}
<template> <template>
<el-dialog <el-dialog
:visible.sync="showLamaDialog" :visible.sync="showLamaDialog"
:before-close="handleClose"
title="去水印" title="去水印"
width="1000px"> width="1000px">
<div > <div >
...@@ -34,6 +35,9 @@ export default { ...@@ -34,6 +35,9 @@ export default {
}, },
// vue实例销毁时销毁一些监听事件 // vue实例销毁时销毁一些监听事件
methods: { methods: {
handleClose() {
this.$emit('closeLamaDialog')
},
handleMessage(event) { handleMessage(event) {
console.log('===从子应用的传递的===', event.data) console.log('===从子应用的传递的===', event.data)
const data = event.data const data = event.data
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
<LamaImageDialog <LamaImageDialog
v-if="showLamaImageDialog" v-if="showLamaImageDialog"
:show-lama-dialog="showLamaImageDialog" :show-lama-dialog="showLamaImageDialog"
@closeLamaDialog="showLamaImageDialog = false"
@imageBase64="handleGetImageBase64" /> @imageBase64="handleGetImageBase64" />
</div> </div>
...@@ -68,6 +69,10 @@ export default { ...@@ -68,6 +69,10 @@ export default {
this.$message.error('请选择图片') this.$message.error('请选择图片')
return return
} }
if (this.imageList[this.currentPosition].indexOf('https://cdn.wanwudezhi.com') === -1) {
this.$message.error('该图片不支持该操作')
return
}
if (this.selectType === 1) { // 去水印 if (this.selectType === 1) { // 去水印
const result = this.copyContent(this.imageList[this.currentPosition]) const result = this.copyContent(this.imageList[this.currentPosition])
if (result) { if (result) {
......
...@@ -4,14 +4,14 @@ ...@@ -4,14 +4,14 @@
<el-button round @click="handleCancel">取消</el-button> <el-button round @click="handleCancel">取消</el-button>
<el-button type="primary" style="margin-right: 20px" round @click="handlePublish">发布</el-button> <el-button type="primary" style="margin-right: 20px" round @click="handlePublish">发布</el-button>
<el-button-group> <el-button-group>
<el-button type="primary" icon="el-icon-arrow-left">上一个</el-button> <el-button :disabled="previousDisabled" type="primary" icon="el-icon-arrow-left" @click="handlePrevious">上一个</el-button>
<el-button type="primary">下一个<i class="el-icon-arrow-right el-icon--right" /></el-button> <el-button type="primary" @click="handleNext">下一个<i class="el-icon-arrow-right el-icon--right"/></el-button>
</el-button-group> </el-button-group>
</div> </div>
<el-card class="box-card"> <el-card class="box-card">
<div class="detail"> <div class="detail">
<div class="detail_title">{{ `名称:` }}</div> <div class="detail_title">{{ `名称:${goodsParams.name || ''}` }}</div>
<div class="detail_desc">{{ `详细介绍:` }}</div> <div class="detail_desc">{{ `详细介绍:${goodsParams.detail || ''}` }}</div>
<div class="detail_image"> <div class="detail_image">
<div class="detail_title">{{ `钱币图片:` }}</div> <div class="detail_title">{{ `钱币图片:` }}</div>
<div class="list"> <div class="list">
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<div class="tool"> <div class="tool">
<div>第二步:对去完水印的图片进行抠图</div> <div>第二步:对去完水印的图片进行抠图</div>
<div v-if="!src && isShowCutImage" class="select"> <div v-if="!src && isShowCutImage" class="select">
<el-button style="width: 95px" @click="handleSelectImage">在线选图</el-button> <el-button style="width: 95px" @click="handleSelectImage(0)">在线选图</el-button>
<el-button <el-button
type="primary" type="primary"
style="position: relative;overflow: hidden;margin-top: 20px;margin-left: 0px; ">本地上传 style="position: relative;overflow: hidden;margin-top: 20px;margin-left: 0px; ">本地上传
...@@ -161,23 +161,23 @@ ...@@ -161,23 +161,23 @@
@change="handleCategoryChange"/> @change="handleCategoryChange"/>
</el-form-item> </el-form-item>
<el-form-item label="直径(mm):" prop="name"> <el-form-item label="直径(mm):" prop="name">
<el-input v-model="goodsParams.name" :style="{ 'width':'300px' }" placeholder="请输入直径(mm)" /> <el-input v-model="goodsParams.diameter" :style="{ 'width':'300px' }" placeholder="请输入直径(mm)" />
</el-form-item> </el-form-item>
<el-form-item label="厚度(mm):" prop="name"> <el-form-item label="厚度(mm):" prop="name">
<el-input v-model="goodsParams.name" :style="{ 'width':'300px' }" placeholder="请输入厚度(mm)" /> <el-input v-model="goodsParams.thickness" :style="{ 'width':'300px' }" placeholder="请输入厚度(mm)" />
</el-form-item> </el-form-item>
<el-form-item label="质量(g):" prop="name"> <el-form-item label="质量(g):" prop="name">
<el-input v-model="goodsParams.name" :style="{ 'width':'300px' }" placeholder="请输入质量(g)" /> <el-input v-model="goodsParams.weight" :style="{ 'width':'300px' }" placeholder="请输入质量(g)" />
</el-form-item> </el-form-item>
<el-form-item label="是否作为标准货币:" prop="isOnSale"> <el-form-item label="是否作为标准货币:" prop="isOnSale">
<el-radio-group v-model="goodsParams.isOnSale"> <el-radio-group v-model="goodsParams.isStd">
<el-radio :label="true"></el-radio> <el-radio :label="1"></el-radio>
<el-radio :label="false"></el-radio> <el-radio :label="0"></el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input <el-input
v-model="goodsParams.traceMsg" v-model="goodsParams.remark"
:rows="5" :rows="5"
maxlength="50" maxlength="50"
type="textarea" type="textarea"
...@@ -188,6 +188,7 @@ ...@@ -188,6 +188,7 @@
</el-card> </el-card>
</div> </div>
<SelectImageDialog <SelectImageDialog
v-if="dialogVisible"
:select-image-dialog-visible="dialogVisible" :select-image-dialog-visible="dialogVisible"
:select-type="selectDialogType" :select-type="selectDialogType"
:image-list="goodsParams.images" :image-list="goodsParams.images"
...@@ -202,7 +203,8 @@ ...@@ -202,7 +203,8 @@
import { VuePictureCut, VuePictureCutMask, VuePictureCutMenu } from 'vue-picture-cut' import { VuePictureCut, VuePictureCutMask, VuePictureCutMenu } from 'vue-picture-cut'
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import SelectImageDialog from './components/selectImageDialog' import SelectImageDialog from './components/selectImageDialog'
import { detailGoods, listCategories } from '@/api/business/goods' import { listCategories } from '@/api/business/goods'
import { detailGoods, editGoods } from '@/api/business/goodsNew'
export default { export default {
name: 'InfoSet', name: 'InfoSet',
...@@ -237,9 +239,9 @@ export default { ...@@ -237,9 +239,9 @@ export default {
categoryList: [], // 所属分类 categoryList: [], // 所属分类
categoryIds: [], categoryIds: [],
goodsParams: { images: [] }, goodsParams: { images: [] },
goodId: '',
goodIdList: [], goodIdList: [],
goodItemIndex: -1 currentIndex: 0,
isDisabledNext: false
} }
}, },
...@@ -259,6 +261,9 @@ export default { ...@@ -259,6 +261,9 @@ export default {
}, },
newSecondSrc() { newSecondSrc() {
return this.blobSecond ? URL.createObjectURL(this.blobSecond) : '' return this.blobSecond ? URL.createObjectURL(this.blobSecond) : ''
},
previousDisabled() {
return !(this.currentIndex - 1 >= 0 && this.currentIndex - 1 < this.goodIdList.length)
} }
}, },
watch: { watch: {
...@@ -279,20 +284,7 @@ export default { ...@@ -279,20 +284,7 @@ export default {
if (this.$route.query.id == null) { if (this.$route.query.id == null) {
return return
} }
this.handleGetDetail(this.$route.query.id)
this.goodId = this.$route.query.id
detailGoods(this.goodId).then(response => {
this.goodsParams = response.data.data.goods
this.categoryIds = response.data.data.categoryIds
this.itemImages = []
for (let i = 0; i < this.goodsParams.images.length; i++) {
this.itemImages.push({
url: this.goodsParams.images[i]
})
}
})
listCategories().then(response => { listCategories().then(response => {
this.categoryList = response.data.data.categoryList this.categoryList = response.data.data.categoryList
}) })
...@@ -306,6 +298,47 @@ export default { ...@@ -306,6 +298,47 @@ export default {
}, 1000) }, 1000)
} }
}, },
handleGetDetail(id, type) {
const param = {
id: id,
idExcludeList: this.goodIdList || []
}
detailGoods(param).then(response => {
this.handleClearInfo()
if (type === 1) { // 上一个
this.currentIndex -= 1
} else if (type === 2) { // 下一个
this.currentIndex += 1
} else if (type === 3) {
this.currentIndex += 1
if (this.goodIdList.indexOf(response.data.data.id) === -1) {
this.goodIdList[this.goodIdList.length] = response.data.data.id
}
} else {
if (this.goodIdList.indexOf(response.data.data.id) === -1) {
this.goodIdList[this.goodIdList.length] = response.data.data.id
}
}
console.log('===list==', this.goodIdList)
this.goodsParams = response.data.data
this.goodsParams.isStd = response.data.data.isStd === true ? 1 : 0
if (this.goodsParams.cid) {
this.categoryIds = [this.goodsParams.cid]
}
if (response.data.data.images) {
this.goodsParams.images = response.data.data.images.split(';')
}
})
},
handleClearInfo() {
this.goodsParams = {}
this.base64 = ''
this.base64Second = ''
this.blob = ''
this.blobSecond = ''
this.src = ''
},
// 选择图片结果 // 选择图片结果
fileChange(e) { fileChange(e) {
if (e.target.files.length) { if (e.target.files.length) {
...@@ -319,7 +352,10 @@ export default { ...@@ -319,7 +352,10 @@ export default {
}, },
// 发布 // 发布
handlePublish() { handlePublish() {
editGoods(this.goodsParams).then(response => {
this.$message.success('发布成功')
this.handleNext()
})
}, },
// 选择形状 // 选择形状
handleChangeShape(type) { handleChangeShape(type) {
...@@ -457,12 +493,32 @@ export default { ...@@ -457,12 +493,32 @@ export default {
// 转换base64格式的图片 // 转换base64格式的图片
setTimeout(() => { setTimeout(() => {
this.compositeImageSrc = canvas.toDataURL('image/png') this.compositeImageSrc = canvas.toDataURL('image/png')
this.goodsParams.imgBaseStr = this.compositeImageSrc
console.log('=====img==', this.compositeImageSrc) console.log('=====img==', this.compositeImageSrc)
}, 1000) }, 1000)
}, },
// 分类结果 // 分类结果
handleCategoryChange(value) { handleCategoryChange(value) {
this.goodsParams.cid = value[value.length - 1] this.goodsParams.cid = value[value.length - 1]
},
// 上一个
handlePrevious() {
const preIndex = this.currentIndex - 1
if (preIndex >= 0 && preIndex < this.goodIdList.length) {
const id = this.goodIdList[preIndex]
this.handleGetDetail(id, 1)
} else {
this.$message.info('已经是第一个了哦~')
}
},
handleNext() {
const nextIndex = this.currentIndex + 1
if (nextIndex >= 0 && nextIndex < this.goodIdList.length) {
const id = this.goodIdList[nextIndex]
this.handleGetDetail(id, 2)
} else {
this.handleGetDetail('', 3)
}
} }
} }
} }
...@@ -562,8 +618,7 @@ export default { ...@@ -562,8 +618,7 @@ export default {
.cut { .cut {
width: 100%; width: 100%;
height: 280px; height: 400px;
overflow: hidden;
margin-top: 20px; margin-top: 20px;
} }
......
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