|
|
@@ -0,0 +1,275 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <el-button type="text" @click="onShow" size="mini">营销费用明细></el-button>
|
|
|
+ <el-dialog
|
|
|
+ :title="title"
|
|
|
+ :visible.sync="dialogVisible"
|
|
|
+ width="60%"
|
|
|
+ append-to-body
|
|
|
+ :show-close="false"
|
|
|
+ >
|
|
|
+ <el-input style="width:200px;margin-bottom: 20px" placeholder="搜索" :suffix-icon="param.content.where.condition?param.content.where.condition.length > 0?'':'':'el-icon-search'" v-model="param.content.where.condition" @keyup.native.enter="listData(param.content.pageNumber = 1)" @clear="listData(param.content.pageNumber = 1)" size="small" class="input-with-select inline-16 layout_search__panel" clearable>
|
|
|
+ </el-input>
|
|
|
+ <el-button class="inline-16" type="primary" size="small" @click="addClick" v-if="tool.checkAuth($route.name,'marketingExpenses')">新增费用明细</el-button>
|
|
|
+ <el-table :data="list" border size="mini" :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
|
|
|
+ :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}" height="calc(100vh - 600px)" >
|
|
|
+ <el-table-column width="200" label="单号">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span style="margin-left: 10px">{{ scope.row.billno?scope.row.billno:'--' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column width="150" label="业务员">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span style="margin-left: 10px">{{ scope.row.name?scope.row.name:'--' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column width="150" label="部门">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span style="margin-left: 10px">{{ scope.row.depname?scope.row.depname:'--' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column width="200" label="客户名称">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span style="margin-left: 10px">{{ scope.row.enterprisename?scope.row.enterprisename:'--' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column width="200" label="项目名称">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span style="margin-left: 10px">{{ scope.row.projectname?scope.row.projectname:'--' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column width="150" label="联系人">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span style="margin-left: 10px">{{ scope.row.names?scope.row.names:'--' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column width="200" label="费用类型">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span style="margin-left: 10px">{{ scope.row.feestypefullname?scope.row.feestypefullname:'--' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column width="200" label="营销费用(元)">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span style="margin-left: 10px">{{ scope.row.amount?scope.row.amount:'--' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column width="120" label="操作" fixed="right" v-if="tool.checkAuth($route.name,'marketingExpenses')">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button type="text" class="inline-16" @click="editClick(scope.row)" >编辑</el-button>
|
|
|
+ <el-button type="text" class="inline-16" @click="delClick(scope.row)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <div class="container normal-panel" style="text-align:right">
|
|
|
+ <el-pagination
|
|
|
+ background
|
|
|
+ @size-change="handleSizeChange"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ :current-page="currentPage"
|
|
|
+ :page-sizes="[20, 50, 100, 200]"
|
|
|
+ :page-size="20"
|
|
|
+ layout="total,sizes, prev, pager, next, jumper"
|
|
|
+ :total="total">
|
|
|
+ </el-pagination>
|
|
|
+ </div>
|
|
|
+ <div slot="footer" class="dialog-footer" style="margin-top: 0;!important;">
|
|
|
+ <el-button @click="onClose" size="small">关闭</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ <el-dialog :title="formTitle" :visible.sync="dialogFormVisible" append-to-body :show-close="false">
|
|
|
+ <el-form :model="form" ref="formRef" label-width="120" :rules="rules" label-position="right" size="small">
|
|
|
+ <el-form-item label="费用类型:" prop="feestype">
|
|
|
+ <el-select v-model="form.feestype" placeholder="请选择营销费用类型" style="width: 85%">
|
|
|
+ <el-option v-for="item in feestype" :key="item.index" :label="item.value + item.remarks" :value="item.value"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="营销费用:" prop="amount">
|
|
|
+ <el-input type="number" style="width: 85%" v-model="form.amount" autocomplete="off" placeholder="请填写金额(元)" @change="amountChange"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="dialogFormVisible = false" size="small">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="onSubmit" size="small">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+export default {
|
|
|
+ name: "index",
|
|
|
+ props:['ownertable','ownerid','dataTime','userid'],
|
|
|
+ data(){
|
|
|
+ return{
|
|
|
+ dialogVisible:false,
|
|
|
+ list:[],
|
|
|
+ param:{
|
|
|
+ "id": 20240629082704,
|
|
|
+ "content": {
|
|
|
+ "ownertable": "",//传当前应用tablename 比如sat_orderclue,sa_customers,sa_project,sys_phonebook
|
|
|
+ "ownerid": '',//传跟进记录id 跟进线索为sat_ordercluefollowuplogid 其余跟进记录传sys_datafollowupid
|
|
|
+ "pageSize": 20,
|
|
|
+ "pageNumber": 1,
|
|
|
+ "where": {
|
|
|
+ "condition": ""
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ currentPage:0,
|
|
|
+ total:0,
|
|
|
+ title:'',
|
|
|
+ dialogFormVisible:false,
|
|
|
+ form:{
|
|
|
+ "ownertable": "",//传当前应用tablename 比如sat_orderclue,sa_customers,sa_project,sys_phonebook
|
|
|
+ "ownerid": '',//传跟进记录id 跟进线索为sat_ordercluefollowuplogid 其余跟进记录传sys_datafollowupid
|
|
|
+ "feestype": "",
|
|
|
+ "followupdate": "",
|
|
|
+ "amount":""
|
|
|
+ },
|
|
|
+ feestype:[],
|
|
|
+ formTitle:'',
|
|
|
+ rules: {
|
|
|
+ feestype: [
|
|
|
+ {required: true, message: '还未选择营销费用类型', trigger: 'change'},
|
|
|
+ ],
|
|
|
+ amount: [
|
|
|
+ {required: true, message: '请填写营销费用', trigger: 'blur'},
|
|
|
+ ],
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ methods:{
|
|
|
+ async onShow(){
|
|
|
+ this.dialogVisible = true
|
|
|
+ this.title = this.dataTime + ' 跟进_费用明细'
|
|
|
+ this.param.content.where.condition = ''
|
|
|
+ this.listData(this.param.content.pageNumber = 1)
|
|
|
+ const res = await this.$store.dispatch('optiontypeselect','feestype')
|
|
|
+ this.feestype = res.data
|
|
|
+ console.log(this.feestype,'feestype')
|
|
|
+ },
|
|
|
+ async listData(){
|
|
|
+ this.param.content.ownertable = this.ownertable
|
|
|
+ this.param.content.ownerid = this.ownerid
|
|
|
+ const res = await this.$api.requested(this.param)
|
|
|
+ this.list = res.data
|
|
|
+ this.currentPage = res.pageNumber
|
|
|
+ this.total = res.total
|
|
|
+ },
|
|
|
+ handleSizeChange(val) {
|
|
|
+ // console.log(`每页 ${val} 条`);
|
|
|
+ this.param.content.pageSize = val
|
|
|
+ this.listData()
|
|
|
+ },
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ // console.log(`当前页: ${val}`);
|
|
|
+ this.param.content.pageNumber = val
|
|
|
+ this.listData()
|
|
|
+ },
|
|
|
+ addClick(){
|
|
|
+ this.dialogFormVisible = true
|
|
|
+ this.formTitle = '新建营销费用明细'
|
|
|
+ },
|
|
|
+ editClick(data){
|
|
|
+ this.dialogFormVisible = true
|
|
|
+ this.formTitle = '编辑营销费用明细'
|
|
|
+ this.form.feestype = data.feestype
|
|
|
+ this.form.amount = data.amount
|
|
|
+ this.form.sa_salesfeesid = data.sa_salesfeesid
|
|
|
+ this.form.sa_salesfeesdetailid = data.sa_salesfeesdetailid
|
|
|
+ },
|
|
|
+ onSubmit(){
|
|
|
+ this.$refs.formRef.validate(async (valid) => {
|
|
|
+ if (!valid) return false
|
|
|
+ if (this.formTitle == '新建营销费用明细'){
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": 20240629090604,
|
|
|
+ "content": {
|
|
|
+ "userid": this.userid,
|
|
|
+ "salesfeesdetail": {
|
|
|
+ "ownertable": this.ownertable,
|
|
|
+ "ownerid": this.ownerid,
|
|
|
+ "feestype": this.form.feestype,
|
|
|
+ "followupdate": this.dataTime,
|
|
|
+ "amount":this.form.amount
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,()=>{
|
|
|
+ this.dialogFormVisible = false
|
|
|
+ this.listData(this.param.content.pageNumber = 1)
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": "20240611093004",
|
|
|
+ "content": {
|
|
|
+ "sa_salesfeesid": this.form.sa_salesfeesid,
|
|
|
+ "salesfeesdetail": [
|
|
|
+ {
|
|
|
+ "sa_salesfeesdetailid": this.form.sa_salesfeesdetailid,
|
|
|
+ "ownerid": this.ownerid,
|
|
|
+ "ownertable": this.ownertable,
|
|
|
+ "feestype": this.form.feestype,
|
|
|
+ "amount": this.form.amount,
|
|
|
+ "followupdate": this.dataTime
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,()=>{
|
|
|
+ this.dialogFormVisible = false
|
|
|
+ this.listData(this.param.content.pageNumber = 1)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onClose(){
|
|
|
+ this.dialogVisible = false
|
|
|
+ this.$emit('onSuccess')
|
|
|
+ },
|
|
|
+ delClick(data) {
|
|
|
+ this.$confirm('是否删除该数据?', '提示', {
|
|
|
+ confirmButtonText: '删除',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(async() => {
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": 20240611095304,
|
|
|
+ "content": {
|
|
|
+ "sa_salesfeesid":data.sa_salesfeesid,
|
|
|
+ "sa_salesfeesdetails": [
|
|
|
+ {
|
|
|
+ "sa_salesfeesdetailid": data.sa_salesfeesdetailid,
|
|
|
+ "followupdate": this.dataTime
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.tool.showMessage(res,()=>{
|
|
|
+ this.listData(this.param.content.pageNumber = 1)
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消删除'
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ amountChange(){
|
|
|
+ if (this.form.amount < 0){
|
|
|
+ this.form.amount = -Math.round((Math.abs(this.form.amount))*100)/100
|
|
|
+ }else {
|
|
|
+ this.form.amount = Math.round(this.form.amount * 100)/100
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+/deep/ .el-dialog__body {
|
|
|
+ padding: 20px 20px 0 20px !important;
|
|
|
+}
|
|
|
+</style>
|