Commit 07f59c99 authored by yaya's avatar yaya

feat: 添加用户凭证弹窗功能

parent 7a990755
......@@ -50,3 +50,19 @@ export function confirmReceive(params) {
data: params
})
}
export function finishSettlement(params) {
return request({
url: '/consignSaleManage/finishSettlement',
method: 'post',
data: params
})
}
export function getSettlementInfo(params) {
return request({
url: '/consignSaleManage/getSettlementInfo',
method: 'post',
data: params
})
}
<template>
<el-dialog
v-if="finishDialogShow"
:visible.sync="finishDialogShow"
:before-close="handleCancelFinishDialog"
width="600px"
height="800px"
title="货品售出">
<el-form ref="finish" :model="saleForm" >
<el-form-item>
<div v-if="saleUserInfo" class="sale_info">{{ `向${saleUserInfo.name || '-'}(手机号:${saleUserInfo.phone || '-'})转账${saleUserInfo.settleAmount || '-'}元` }}</div>
</el-form-item>
<el-form-item label="商品图片">
<el-upload
:action="uploadPath"
:headers="headers"
:limit="3"
:file-list="itemImages"
:on-exceed="uploadOverrun"
:on-success="handleGalleryUrl"
:on-remove="handleRemove"
multiple
accept=".jpg,.jpeg,.png,.gif"
list-type="picture-card">
<i class="el-icon-plus"/>
</el-upload>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="handleCancelFinishDialog"> </el-button>
<el-button type="primary" @click="handleFinishValue"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { MessageBox } from 'element-ui'
import { finishSettlement, getSettlementInfo } from '@/api/business/consign'
import { uploadPath } from '@/api/business/storage'
import { getToken } from '@/utils/auth'
export default {
name: 'FinishSettlementDialog',
props: {
finishDialogShow: {
type: Boolean,
default: false
},
saleId: {
type: String,
default: ''
}
},
data() {
return {
uploadPath,
itemImages: [],
// 货品售出
saleForm: {
images: []
},
saleUserInfo: {}
// finishRules: {
// dealPrice: [
// { required: true, message: '成交金额不能为空', trigger: 'blur' },
// {
// pattern: /^[1-9]\d*$/,
// message:
// '格式不正确,请输入正整数!'
// }
// ],
// remark: [
// { required: true, message: '原因不能为空', trigger: 'blur' }
// ]
// }
}
},
computed: {
headers() {
return {
'X-Dts-Admin-Token': getToken()
}
}
},
created() {
this.handleGetSettlementInfo()
},
methods: {
uploadOverrun: function() {
this.$message({
type: 'error',
message: '上传文件个数超出限制!最多上传3张凭证!'
})
},
handleGalleryUrl(response, file, fileList) {
if (response.errno === 0) {
this.saleForm.images.push(response.data.url)
}
},
handleRemove: function(file, fileList) {
var url
if (file.response === undefined) {
url = file.url
} else {
url = file.response.data.url
}
if (url === this.goods.topImage) {
this.goods.topImage = ''
}
for (var i = 0; i < this.goods.images.length; i++) {
// 这里存在两种情况
// 1. 如果所删除图片是刚刚上传的图片,那么图片地址是file.response.data.url
// 此时的file.url虽然存在,但是是本机地址,而不是远程地址。
// 2. 如果所删除图片是后台返回的已有图片,那么图片地址是file.url
if (url === this.goods.topImage) {
this.goods.topImage = ''
}
if (this.goods.images[i] === url) {
this.goods.images.splice(i, 1)
}
}
},
handleCancelFinishDialog() {
this.$emit('cancelDialog')
},
handleGetSettlementInfo() {
if (this.saleId) {
const params = { credential: this.saleForm.images.join(';'), saleId: this.saleId }
getSettlementInfo(params)
.then(response => {
this.saleUserInfo = response.data.data
console.log('==凭证信息=', response)
})
.catch(response => {
MessageBox.alert('业务错误:' + response.data.errmsg, '警告', {
confirmButtonText: '确定',
type: 'error'
})
})
}
},
/**
* 实物评估
*/
handleFinishValue() {
if (!this.saleForm.images || this.saleForm.images.length === 0) {
this.$notify.error({
message: '请上传凭证'
})
return
}
if (this.saleId) {
const params = { credential: this.saleForm.images.join(';'), saleId: this.saleId }
this.$refs.finish.validate((valid) => {
if (valid) {
finishSettlement(params)
.then(response => {
this.$notify.success({
message: '上传成功'
})
this.$emit('refreshList')
this.$emit('cancelDialog')
})
.catch(response => {
MessageBox.alert('业务错误:' + response.data.errmsg, '警告', {
confirmButtonText: '确定',
type: 'error'
})
})
}
})
}
}
}
}
</script>
<style lang="scss" scoped>
.sale_info {
color: rgb(81, 90, 110);
font-size: 15px;
font-weight: 700;
}
.content {
width: 100%;
text-align: center;
}
.image {
width: 400px;
height: auto;
}
</style>
......@@ -34,6 +34,12 @@
size="mini"
@click="finishDialogShow = true">货品售出
</el-button>
<el-button
v-if="systemState === 16"
type="primary"
size="mini"
@click="finishSettlementDialogShow = true">向用户结款
</el-button>
<el-button
v-if="systemState < 20"
type="danger"
......@@ -107,6 +113,13 @@
@cancelDialog="finishDialogShow = false"
@refreshList="handleGetDetail"
/>
<FinishSettlementDialog
v-if="finishSettlementDialogShow"
:finish-dialog-show="finishSettlementDialogShow"
:sale-id="saleId"
@cancelDialog="finishSettlementDialogShow = false"
@refreshList="handleGetDetail"
/>
<el-dialog
v-if="cancelConsignDialogShow"
:visible.sync="cancelConsignDialogShow"
......@@ -156,10 +169,11 @@ import CheckVideoDialog from '../goods/components/CheckVideoDialog'
import IdentifyValueDialog from './components/IdentifyValueDialog'
import ImageValueDialog from './components/ImageValueDialog'
import SaleConsignDialog from './components/SaleConsignDialog'
import FinishSettlementDialog from './components/FinishSettlementDialog'
export default {
name: 'ConsignDetail',
components: { SaleConsignDialog, ImageValueDialog, IdentifyValueDialog, CheckVideoDialog, CheckLargeImageDialog },
components: { FinishSettlementDialog, SaleConsignDialog, ImageValueDialog, IdentifyValueDialog, CheckVideoDialog, CheckLargeImageDialog },
data() {
return {
saleId: '',
......@@ -180,6 +194,8 @@ export default {
// 货品售出
finishDialogShow: false,
// 寄售凭证
finishSettlementDialogShow: false,
// 取消
cancelForm: {
content: '',
......
......@@ -98,7 +98,7 @@
v-if="scope.row.systemState === 16"
type="primary"
size="mini"
@click="handleFinishDialogShow(scope.row)">向用户结款
@click="handleFinishSettlementDialogShow(scope.row)">向用户结款
</el-button>
<el-button
v-if="scope.row.systemState < 16"
......@@ -132,6 +132,7 @@
@cancelIdentifyDialog="identifyValueDialogShow = false"
@refreshList="getList"
/>
<!--货品售出-->
<SaleConsignDialog
v-if="finishDialogShow"
:sale-id="currentSaleId"
......@@ -139,6 +140,14 @@
@cancelDialog="finishDialogShow = false"
@refreshList="getList"
/>
<!--寄售凭证-->
<FinishSettlementDialog
v-if="finishSettlementDialogShow"
:sale-id="currentSaleId"
:finish-dialog-show="finishSettlementDialogShow"
@cancelDialog="finishSettlementDialogShow = false"
@refreshList="getList"
/>
<el-dialog
v-if="cancelConsignDialogShow"
:visible.sync="cancelConsignDialogShow"
......@@ -174,15 +183,17 @@
<script>
import Line2Hidden from '@/components/line2Hidden'
import Pagination from '@/components/Pagination'
import { findConsignList, confirmReceive, identifyImage, cancelValue } from '@/api/business/consign'
import { findConsignList, confirmReceive, cancelValue } from '@/api/business/consign'
import { MessageBox } from 'element-ui'
import IdentifyValueDialog from './components/IdentifyValueDialog'
import ImageValueDialog from './components/ImageValueDialog'
import SaleConsignDialog from './components/SaleConsignDialog'
import FinishSettlementDialog from './components/FinishSettlementDialog'
export default {
name: 'ConsignList',
components: {
FinishSettlementDialog,
SaleConsignDialog,
ImageValueDialog,
IdentifyValueDialog,
......@@ -234,6 +245,8 @@ export default {
identifyValueDialogShow: false,
// 货品售出
finishDialogShow: false,
// 寄售凭证
finishSettlementDialogShow: false,
currentSaleId: '',
// 取消
......@@ -336,34 +349,6 @@ export default {
this.currentSaleId = item.saleId
this.itemContent = item
},
/**
* 实物评估
*/
handleIdentifyValue() {
if (this.itemContent) {
const params = { ...this.identifyValueForm, saleId: this.itemContent.saleId }
this.$refs.identifyValue.validate((valid) => {
if (valid) {
identifyImage(params)
.then(response => {
this.itemContent = {}
this.identifyValueDialogShow = false
this.identifyValueForm = {}
this.$notify.success({
message: '实物评估成功'
})
this.getList()
})
.catch(response => {
MessageBox.alert('业务错误:' + response.data.errmsg, '警告', {
confirmButtonText: '确定',
type: 'error'
})
})
}
})
}
},
/**
* 货品售出
*/
......@@ -376,8 +361,9 @@ export default {
* 待用户结款
*/
handleFinishSettlementDialogShow(item) {
this.finishDialogShow = true
this.finishSettlementDialogShow = true
this.itemContent = item
this.currentSaleId = item.saleId
},
/**
* 取消寄售
......
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