|
@@ -12,6 +12,10 @@
|
|
|
@click.stop="openCheckDialog">
|
|
|
审批
|
|
|
</el-button>
|
|
|
+ <!--<el-button type="primary" size="small" v-if="form.confirmStatus == 1" @click="newAddfun">新建销售单-->
|
|
|
+ <!--</el-button>-->
|
|
|
+ <el-button type="warning" size="small" v-if="form.confirmStatus == 1" @click.stop="clickPayment">付款
|
|
|
+ </el-button>
|
|
|
<el-button type="info" icon="el-icon-printer" size="small" @click.stop="openReport()">报表打印
|
|
|
</el-button>
|
|
|
<el-button type="primary" size="small" v-if="detailData.status == 1 && form.confirmStatus == 0"
|
|
@@ -51,15 +55,18 @@
|
|
|
</avue-form>
|
|
|
</trade-card>
|
|
|
<trade-card title="商品信息" v-loading="loadingBtn">
|
|
|
- <avue-form class="trading-form" v-model="form" :option="option2">
|
|
|
+ <avue-form ref="option2form" class="trading-form" v-model="form" :option="option2">
|
|
|
<template slot="thisUsedProfit">
|
|
|
- <el-input-number v-model="form.thisUsedProfit" :disabled="detailData.status == 1" @change="amountChange"
|
|
|
- placeholder="请输入" size="small" :controls="false" style="width:100%;"></el-input-number>
|
|
|
+ <el-input-number v-model="form.thisUsedProfit" :disabled="detailData.status == 1"
|
|
|
+ placeholder="请输入" size="small" :controls="false" style="width:100%;"
|
|
|
+ @change="thisUsedchange" ></el-input-number>
|
|
|
+ <!--@change="amountChange"-->
|
|
|
</template>
|
|
|
<template slot="memberBalance">
|
|
|
<el-input-number v-model="form.memberBalance" :disabled="detailData.status == 1"
|
|
|
- placeholder="请输入" size="small" :controls="false"></el-input-number>
|
|
|
- <span style="margin-left: 10px">{{balanceAmounts}}</span>
|
|
|
+ placeholder="请输入" size="small" :controls="false"
|
|
|
+ @change="memberchange"></el-input-number>
|
|
|
+ <span style="margin-left: 10px">余额:{{balanceAmounts}}</span>
|
|
|
</template>
|
|
|
</avue-form>
|
|
|
<avue-crud ref="crud" :option="optionList" :data="data" :table-loading="loading" @saveColumn="saveColumn"
|
|
@@ -140,6 +147,39 @@
|
|
|
<check :checkData="checkData" :checkDetail="false" :idList="[]" @choceCheckFun="choceCheckFun">
|
|
|
</check>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <!--付款的弹窗-->
|
|
|
+ <!--<el-dialog-->
|
|
|
+ <!-- title="付款"-->
|
|
|
+ <!-- :visible.sync="paymentVisible"-->
|
|
|
+ <!-- append-to-body-->
|
|
|
+ <!-- :close-on-click-modal="false"-->
|
|
|
+ <!-- :destroy-on-close="true"-->
|
|
|
+ <!-- :close-on-press-escape="false"-->
|
|
|
+ <!-- v-dialog-drag-->
|
|
|
+ <!-- width="40%"-->
|
|
|
+ <!-- :before-close="paymentClose">-->
|
|
|
+ <!-- <div>-->
|
|
|
+ <!-- <el-form ref="form" label-width="100px" size="mini">-->
|
|
|
+ <!-- <el-form-item label="总支付金额">-->
|
|
|
+ <!-- {{form.purchaseAmount}}-->
|
|
|
+ <!-- </el-form-item>-->
|
|
|
+ <!-- <el-form-item label="会员卡余额">-->
|
|
|
+ <!-- {{balanceAmounts}}-->
|
|
|
+ <!-- </el-form-item>-->
|
|
|
+ <!-- <el-form-item label="会员卡支付金额">-->
|
|
|
+ <!-- <el-input type="number" v-model="form.memberBalance" @change="memberBalancechange"></el-input>-->
|
|
|
+ <!-- </el-form-item>-->
|
|
|
+ <!-- <el-form-item label="现金支付金额">-->
|
|
|
+ <!-- <el-input type="number" v-model="form.wechatpayAmount"></el-input>-->
|
|
|
+ <!-- </el-form-item>-->
|
|
|
+ <!-- </el-form>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- <span slot="footer" class="dialog-footer">-->
|
|
|
+ <!-- <el-button @click="paymentVisible = false">取 消</el-button>-->
|
|
|
+ <!-- <el-button type="primary" @click="paymentVisible = false">确 定</el-button>-->
|
|
|
+ <!-- </span>-->
|
|
|
+ <!--</el-dialog>-->
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -156,7 +196,8 @@ import {
|
|
|
revoke,
|
|
|
collectPayment,
|
|
|
getStoragelist,
|
|
|
- offset
|
|
|
+ offset,
|
|
|
+ obtainPrice
|
|
|
} from "@/api/basicData/salesOrder";
|
|
|
import feeInfo from "./components/feeInfo.vue";
|
|
|
import reportDialog from "@/components/report-dialog/main";
|
|
@@ -167,6 +208,8 @@ export default {
|
|
|
name: "index",
|
|
|
data() {
|
|
|
return {
|
|
|
+ // 付款的弹窗开启和关闭
|
|
|
+ paymentVisible:false,
|
|
|
checkDialog: false,
|
|
|
checkData: {},
|
|
|
switchDialog: false,
|
|
@@ -176,9 +219,7 @@ export default {
|
|
|
addressVisible: false,
|
|
|
form: {},
|
|
|
form2: {},
|
|
|
- form3: {
|
|
|
-
|
|
|
- },
|
|
|
+ form3: {},
|
|
|
data: [],
|
|
|
option: {
|
|
|
menuBtn: false,
|
|
@@ -476,7 +517,7 @@ export default {
|
|
|
orderFilesList: [],
|
|
|
storageoptions: [],
|
|
|
// 会员卡余额
|
|
|
- balanceAmounts:0
|
|
|
+ balanceAmounts:0,
|
|
|
};
|
|
|
},
|
|
|
props: {
|
|
@@ -504,10 +545,104 @@ export default {
|
|
|
}
|
|
|
this.getAllWorkDicts()
|
|
|
getAllgoods().then(res => {
|
|
|
- this.goodsoptions = res.data.data
|
|
|
+ this.goodsoptions = []
|
|
|
+ res.data.data.map(item=>{
|
|
|
+ if(item.status != 1) {
|
|
|
+ this.goodsoptions.push(item)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // this.goodsoptions = res.data.data
|
|
|
});
|
|
|
},
|
|
|
methods: {
|
|
|
+ // // 会员卡支付金额的监听
|
|
|
+ // memberBalancechange(){
|
|
|
+ // if (Number(this.form.memberBalance) < 0) {
|
|
|
+ // this.form.memberBalance = 0
|
|
|
+ // }
|
|
|
+ // this.form.wechatpayAmount = this.form.purchaseAmount - this.form.memberBalance
|
|
|
+ // },
|
|
|
+ // 优惠金额的监听
|
|
|
+ thisUsedchange(){
|
|
|
+ this.form.memberBalance = this.form.memberBalance?this.form.memberBalance:0
|
|
|
+ if(Number(this.form.thisUsedProfit) < 0) {
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.form.thisUsedProfit = 0
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (Number(this.form.thisUsedProfit) > Number(this.form.purchaseAmount)) {
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.form.thisUsedProfit = Number(this.form.purchaseAmount)
|
|
|
+ this.form.memberBalance = 0
|
|
|
+ this.form.currentAmount = 0
|
|
|
+ })
|
|
|
+ }
|
|
|
+ let sum = Number(this.form.purchaseAmount) - Number(this.form.memberBalance)
|
|
|
+ if (Number(this.form.thisUsedProfit) > sum){
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ console.log(this.form.thisUsedProfit)
|
|
|
+ this.form.thisUsedProfit = sum
|
|
|
+ this.form.currentAmount = 0
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ console.log(sum - this.form.thisUsedProfit)
|
|
|
+ this.form.currentAmount = sum - this.form.thisUsedProfit
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 会员卡金额的监听
|
|
|
+ memberchange(){
|
|
|
+ // change事件发生后触发了dom更新,
|
|
|
+ // 而数据更改变化是在dom更新之后,
|
|
|
+ // 这就导致了dom当中挂载的数据值还是更新之前的值,
|
|
|
+ // 并且此后无刷新控制dom重新渲染的指令,使得chhange方法失效。
|
|
|
+ // 用$nextTick函数对绑定值进行更改,
|
|
|
+ // 即在dom初次完成渲染挂载后,修改其值再次触发dom渲染挂载。
|
|
|
+ this.form.thisUsedProfit = this.form.thisUsedProfit?this.form.thisUsedProfit:0
|
|
|
+ if (this.form.memberBalance < 0) {
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.form.memberBalance = 0
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (this.form.memberBalance > Number(this.balanceAmounts)) {
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.form.memberBalance = Number(this.balanceAmounts)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ let sum = Number(this.form.purchaseAmount) - Number(this.form.thisUsedProfit)
|
|
|
+ if (this.form.memberBalance > sum) {
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.form.memberBalance = sum
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ console.log(sum - this.form.memberBalance)
|
|
|
+ this.form.currentAmount = sum - this.form.memberBalance
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 付款点击事件
|
|
|
+ clickPayment(){
|
|
|
+ // 和删除一样的接口 显示要付款的现金
|
|
|
+ this.$confirm(`本次付款需要支付金额为${this.form.currentAmount}`, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(()=>{
|
|
|
+ let form = {
|
|
|
+ ...this.form,
|
|
|
+ orderFilesList: this.orderFilesList
|
|
|
+ }
|
|
|
+ collectPayment(form).then(res=>{
|
|
|
+ console.log(res,632)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ // this.paymentVisible = true
|
|
|
+ },
|
|
|
+ // // 付款弹窗的关闭
|
|
|
+ // paymentClose(){
|
|
|
+ // this.paymentVisible = false
|
|
|
+ // },
|
|
|
//打开审核
|
|
|
openCheckDialog() {
|
|
|
this.checkData = this.detailData.check;
|
|
@@ -537,18 +672,27 @@ export default {
|
|
|
return "padding:0;height:40px;";
|
|
|
},
|
|
|
cnameChange(row) {
|
|
|
+ console.log(row,668)
|
|
|
if (row.cname) {
|
|
|
this.goodsoptions.forEach(e => {
|
|
|
if (e.cname == row.cname) {
|
|
|
row.itemId = e.id
|
|
|
row.unit = e.unit
|
|
|
- row.price = e.standardPrice
|
|
|
+ // row.price = e.standardPrice
|
|
|
row.storageInQuantity = 1
|
|
|
row.amount = e.standardPrice
|
|
|
row.purchasePrice = e.purchasePrice
|
|
|
row.storageAmount = e.purchasePrice
|
|
|
}
|
|
|
})
|
|
|
+ // 根据产品ID和客户id获取产品单价
|
|
|
+ obtainPrice({
|
|
|
+ corpId:this.form.corpId,
|
|
|
+ goodsId:row.itemId
|
|
|
+ }).then(res=>{
|
|
|
+ row.price = res.data.data.salesPrice
|
|
|
+ })
|
|
|
+
|
|
|
} else {
|
|
|
row.itemId = null
|
|
|
row.unit = null
|
|
@@ -560,6 +704,7 @@ export default {
|
|
|
}
|
|
|
this.countChange(row)
|
|
|
},
|
|
|
+ // 之前的优惠金额的监听
|
|
|
amountChange() {
|
|
|
let val = 0
|
|
|
this.data.forEach(e => {
|
|
@@ -597,7 +742,6 @@ export default {
|
|
|
this.form.corpsName = row.cname
|
|
|
this.form.corpTel = row.tel
|
|
|
getCorpDetails({ id: row.id }).then(res => {
|
|
|
- console.log(res.data.data.balanceAmounts,598)
|
|
|
this.balanceAmounts = res.data.data.balanceAmounts
|
|
|
this.findObject(this.option.column, "arrivalAddress").dicData = res.data.data.corpsAddrList;
|
|
|
})
|
|
@@ -670,6 +814,39 @@ export default {
|
|
|
// this.settlementList = row.settlementList
|
|
|
this.getDetail(row.id);
|
|
|
},
|
|
|
+ // 新建销售单
|
|
|
+ newAddfun(){
|
|
|
+ // delete this.form.id
|
|
|
+ this.$refs.form.resetFields()
|
|
|
+ this.form = {}
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.option2form.resetFields()
|
|
|
+ });
|
|
|
+ this.data = [];
|
|
|
+
|
|
|
+
|
|
|
+ this.form.confirmStatus = null
|
|
|
+ this.detailData = []
|
|
|
+ this.detailData.status = 2
|
|
|
+
|
|
|
+ this.settlementList = [];
|
|
|
+ this.orderFilesList = [];
|
|
|
+ this.balanceAmount = 0
|
|
|
+
|
|
|
+ this.option.disabled = false;
|
|
|
+ this.option2.disabled = false;
|
|
|
+ this.$refs.crud.refreshTable();
|
|
|
+ this.$refs.feeInfo.refreshTable();
|
|
|
+
|
|
|
+
|
|
|
+ // // this.$refs.option2form.resetFields()这个做法其实是重置表单到初始值,不是清空表单,
|
|
|
+ // // 当表单第一次在页面中渲染时所用的数据就是初始数据,如果修改对象的表单赋值没有放在nextTick中,
|
|
|
+ // // 就会在表单渲染时就会将这个修改对象作为初始值,
|
|
|
+ // // 所以出现无效了。
|
|
|
+ // // 使用nextTick保证表单在第一次渲染时是空值就可以了。
|
|
|
+ // this.xinjianfasle = true
|
|
|
+ this.$forceUpdate()
|
|
|
+ },
|
|
|
//修改提交触发
|
|
|
editCustomer() {
|
|
|
this.$refs["form"].validate((valid, done) => {
|