Commit bafc1686 authored by yaya's avatar yaya

feat:添加分销商品内容填充

parent 96ae513d
......@@ -14,3 +14,27 @@ export function getSaleList(data) {
data
})
}
export function updateOnSale(data) {
return request({
url: '/supplierItem/updateOnSale',
method: 'post',
data
})
}
export function deleteSaleItem(data) {
return request({
url: 'supplierItem/delete',
method: 'post',
data
})
}
export function findSaleDetail(data) {
return request({
url: '/supplierItem/findDetail',
method: 'post',
data
})
}
......@@ -127,7 +127,7 @@ import { uploadPath, createStorage } from '@/api/business/storage'
import { getToken } from '@/utils/auth'
import Editor from '@tinymce/tinymce-vue'
import { MessageBox } from 'element-ui'
import { createSale } from '../../api/business/sale'
import { createSale, findSaleDetail } from '../../api/business/sale'
export default {
name: 'SaleAdd',
......@@ -192,7 +192,34 @@ export default {
}
}
},
created() {
if (this.$route.query.id == null) {
return
}
this.id = this.$route.query.id
this.timeStr = this.$route.query.timeStr
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
})
this.handleGetDetail(loading)
},
methods: {
handleGetDetail(loading) {
findSaleDetail({ id: this.id })
.then(response => {
if (loading) {
loading.close()
}
})
.catch(response => {
if (loading) {
loading.close()
}
})
},
handleBack() {
if (this.$route.query.noGoBack) {
this.$router.push({ path: '/dashboard' })
......@@ -203,6 +230,9 @@ export default {
handleSave() {
this.$refs.goods.validate((valid) => {
if (valid) {
if (this.numType === -1) {
this.goods.buyLimitNum = -1
}
createSale(this.goods)
.then(response => {
this.$notify.success({
......
......@@ -12,21 +12,46 @@
fit
highlight-current-row>
<!-- <el-table-column align="center" label="排行" width="100px" type="index" />-->
<el-table-column align="center" min-width="100px" prop="saleId" label="寄售单号" />
<el-table-column align="center" min-width="100px" prop="id" label="商品ID" />
<el-table-column align="center" label="图片" prop="itemImg">
<template slot-scope="scope">
<img v-if="scope.row.itemImg" :src="scope.row.itemImg" width="60px" height="60px">
<img v-if="scope.row.images" :src="scope.row.images.split(';')[0]" width="60px" height="60px">
</template>
</el-table-column>
<el-table-column align="center" label="名称" prop="itemName" >
<template slot-scope="scope" >
<Line2Hidden :text="scope.row.itemName" />
<el-table-column align="center" label="标题" prop="name">
<template slot-scope="scope">
<Line2Hidden :text="scope.row.name" />
</template>
</el-table-column>
<el-table-column align="center" label="状态" prop="systemStateName" />
<el-table-column align="center" label="下单时间" prop="saleTime" />
<el-table-column align="center" label="上架类型" prop="type" >
<template slot-scope="scope">
<span class="tooltip-span">{{ `${scope.row.type === 1 ? '一口价' : '竞拍'}` }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="供货价" prop="distributionPrice">
<template slot-scope="scope">
<span class="tooltip-span">{{ `¥ ${scope.row.distributionPrice}` }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="进货价" prop="supplyPrice">
<template slot-scope="scope">
<span class="tooltip-span">{{ `${scope.row.supplyPrice ? `¥ ${scope.row.supplyPrice}` : '-'}` }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="状态" prop="isOnSale" min-width="100px">
<template slot-scope="scope" style="height: 100px">
<el-switch
v-model="scope.row.isOnSale"
:active-text="scope.row.isOnSale ? '上架' : '下架'"
style="display: block"
@change="handleSaleSwitch($event, scope.row)" />
</template>
</el-table-column>
<el-table-column align="center" label="库存" prop="stock" />
<el-table-column align="center" label="累计销量" prop="selledNum" />
<el-table-column align="center" label="更新时间" prop="updateTime" />
<el-table-column align="center" label="操作" width="300">
<template slot-scope="scope">
......@@ -36,10 +61,9 @@
@click="handleToDetail(scope.row)">编辑
</el-button>
<el-button
:disabled="scope.row.isHasPrice"
type="primary"
type="danger"
size="mini"
@click="handleImageValueDialogShow(scope.row)">删除
@click="handleDelete(scope.row)">删除
</el-button>
</template>
</el-table-column>
......@@ -59,7 +83,8 @@
<script>
import Line2Hidden from '@/components/line2Hidden'
import Pagination from '@/components/Pagination'
import { getSaleList } from '@/api/business/sale'
import { getSaleList, updateOnSale, deleteSaleItem } from '@/api/business/sale'
import { MessageBox } from 'element-ui'
export default {
name: 'SaleList',
......@@ -98,6 +123,22 @@ export default {
this.clearAll()
},
methods: {
handleSaleSwitch(e, item) {
const params = { id: item.id, isOnSale: e }
updateOnSale(params)
.then(response => {
this.$notify.success({
message: e ? '上架成功' : '下架成功'
})
})
.catch(response => {
item.isOnSale = !e
MessageBox.alert('业务错误:' + response.data.errmsg, '警告', {
confirmButtonText: '确定',
type: 'error'
})
})
},
handleCreate() {
this.$router.push({ path: '/sale/saleAdd' })
},
......@@ -135,14 +176,33 @@ export default {
* 详情
*/
handleToDetail(item) {
this.$router.push({ path: '/consign/consignDetail', query: { saleId: item.saleId, timeStr: item.timeStr }})
this.$router.push({ path: '/sale/saleAdd', query: { id: item.id }})
},
/**
* 图文评估
* 删除
*/
handleImageValueDialogShow(item) {
this.imageValueDialogShow = true
this.currentSaleId = item.saleId
handleDelete(item) {
this.$confirm('你确定删除吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const data = {
id: item.id
}
deleteSaleItem(data).then((res) => {
this.$notify.success({
title: '成功',
message: '删除成功'
})
this.getList()
}).catch(err => {
this.$notify.error({
title: '失败',
message: err.data.errmsg
})
})
})
},
/**
* 货品签收
......@@ -198,10 +258,15 @@ export default {
</script>
<style scoped>
/deep/ .el-switch {
height: 30px;
}
/deep/ .cell {
display: flex;
justify-content: center;
}
.page_consignList {
padding: 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