|
|
@@ -1,111 +1,15 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
-<!-- <a-row type="flex">-->
|
|
|
-<!-- <a-col :flex="1">1 / 3</a-col>-->
|
|
|
-<!-- <a-col :flex="2">2 / 3</a-col>-->
|
|
|
-<!-- </a-row>-->
|
|
|
-<!-- <a-row type="flex" style="flex-direction: row">-->
|
|
|
-<!-- <a-col :flex="1">-->
|
|
|
-<!-- <a-spin :spinning="confirmLoading">-->
|
|
|
-<!-- <j-form-container >-->
|
|
|
-<!-- <a-form-model ref="form" :model="model" slot="detail">-->
|
|
|
-<!-- <a-row>-->
|
|
|
-<!-- <a-col :span="24">-->
|
|
|
-<!-- <a-form-model-item label="支付方式" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="paymentMethod">-->
|
|
|
-<!-- <a-select-->
|
|
|
-<!-- v-model="model.paymentMethod"-->
|
|
|
-<!-- style="width: 30%"-->
|
|
|
-<!-- placeholder="支付方式" >-->
|
|
|
-<!-- <a-select-option-->
|
|
|
-<!-- v-for="(item, index) in paymentMethodList"-->
|
|
|
-<!-- :key="index"-->
|
|
|
-<!-- :value="item.id"-->
|
|
|
-<!-- >{{ item.name }}</a-select-option>-->
|
|
|
-<!-- </a-select>-->
|
|
|
-<!-- </a-form-model-item>-->
|
|
|
-<!-- </a-col>-->
|
|
|
-<!-- <a-col :span="24">-->
|
|
|
-<!-- <a-form-model-item label="金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="price">-->
|
|
|
-<!-- <a-input-number-->
|
|
|
-<!-- v-model="model.price"-->
|
|
|
-<!-- placeholder="请输入金额"-->
|
|
|
-<!-- style="width: 30%"-->
|
|
|
-<!-- />-->
|
|
|
-<!-- </a-form-model-item>-->
|
|
|
-<!-- </a-col>-->
|
|
|
-<!-- <a-col :span="24">-->
|
|
|
-<!-- <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remarks">-->
|
|
|
-<!-- <a-textarea-->
|
|
|
-<!-- v-model="model.remarks"-->
|
|
|
-<!-- rows="4"-->
|
|
|
-<!-- placeholder="请输入备注"-->
|
|
|
-<!-- style="width: 90%"-->
|
|
|
-<!-- />-->
|
|
|
-<!-- </a-form-model-item>-->
|
|
|
-<!-- </a-col>-->
|
|
|
-
|
|
|
-<!-- </a-row>-->
|
|
|
-<!-- </a-form-model>-->
|
|
|
-<!-- </j-form-container>-->
|
|
|
-<!-- </a-spin>-->
|
|
|
-<!-- </a-col>-->
|
|
|
-<!-- <a-col :flex="2">-->
|
|
|
-<!-- <a-spin :spinning="confirmLoading">-->
|
|
|
-<!-- <j-form-container >-->
|
|
|
-<!-- <a-form-model ref="form" :model="model" slot="detail">-->
|
|
|
-<!-- <a-row>-->
|
|
|
-<!-- <a-col :span="24">-->
|
|
|
-<!-- <a-form-model-item label="支付方式" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="paymentMethod">-->
|
|
|
-<!-- <a-select-->
|
|
|
-<!-- v-model="model.paymentMethod"-->
|
|
|
-<!-- style="width: 30%"-->
|
|
|
-<!-- placeholder="支付方式" >-->
|
|
|
-<!-- <a-select-option-->
|
|
|
-<!-- v-for="(item, index) in paymentMethodList"-->
|
|
|
-<!-- :key="index"-->
|
|
|
-<!-- :value="item.id"-->
|
|
|
-<!-- >{{ item.name }}</a-select-option>-->
|
|
|
-<!-- </a-select>-->
|
|
|
-<!-- </a-form-model-item>-->
|
|
|
-<!-- </a-col>-->
|
|
|
-<!-- <a-col :span="24">-->
|
|
|
-<!-- <a-form-model-item label="金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="price">-->
|
|
|
-<!-- <a-input-number-->
|
|
|
-<!-- v-model="model.price"-->
|
|
|
-<!-- placeholder="请输入金额"-->
|
|
|
-<!-- style="width: 30%"-->
|
|
|
-<!-- />-->
|
|
|
-<!-- </a-form-model-item>-->
|
|
|
-<!-- </a-col>-->
|
|
|
-<!-- <a-col :span="24">-->
|
|
|
-<!-- <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remarks">-->
|
|
|
-<!-- <a-textarea-->
|
|
|
-<!-- v-model="model.remarks"-->
|
|
|
-<!-- rows="4"-->
|
|
|
-<!-- placeholder="请输入备注"-->
|
|
|
-<!-- />-->
|
|
|
-<!-- </a-form-model-item>-->
|
|
|
-<!-- </a-col>-->
|
|
|
-
|
|
|
-<!-- </a-row>-->
|
|
|
-<!-- </a-form-model>-->
|
|
|
-<!-- </j-form-container>-->
|
|
|
-<!-- </a-spin>-->
|
|
|
-<!-- <div style="height: 200px">-->
|
|
|
-
|
|
|
-<!-- </div>-->
|
|
|
-<!-- </a-col>-->
|
|
|
-<!-- </a-row>-->
|
|
|
<div class="contentGoods">
|
|
|
<div class="left">
|
|
|
<a-spin :spinning="confirmLoading">
|
|
|
<j-form-container >
|
|
|
- <a-form-model ref="form" :model="model" slot="detail">
|
|
|
+ <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
|
|
|
<a-row>
|
|
|
<a-col :span="24">
|
|
|
- <a-form-model-item label="消费类目" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="stockType">
|
|
|
+ <a-form-model-item label="消费类目" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="categoryId">
|
|
|
<a-select
|
|
|
- v-model="model.stockType"
|
|
|
+ v-model="model.categoryId"
|
|
|
style="width: 90%"
|
|
|
@change="changeStockType"
|
|
|
placeholder="消费类目" >
|
|
|
@@ -118,10 +22,10 @@
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
<a-col :span="24">
|
|
|
- <a-form-model-item label="消费金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="amount">
|
|
|
+ <a-form-model-item label="消费金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="payPrice">
|
|
|
<a-input-number
|
|
|
disabled
|
|
|
- v-model="model.amount"
|
|
|
+ v-model="model.payPrice"
|
|
|
placeholder="请输入金额"
|
|
|
style="width: 90%"
|
|
|
/>
|
|
|
@@ -146,14 +50,14 @@
|
|
|
<div class="right">
|
|
|
<a-spin :spinning="confirmLoading">
|
|
|
<j-form-container>
|
|
|
- <a-form-model ref="form" :model="model" slot="detail">
|
|
|
+ <a-form-model ref="form" :model="modelCommodity" slot="detail">
|
|
|
<a-row>
|
|
|
<a-col :span="9" v-if="type == 1">
|
|
|
- <a-form-model-item label="" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="childStockType">
|
|
|
+ <a-form-model-item label="" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="categoryTwoId">
|
|
|
<a-select
|
|
|
- v-model="model.childStockType"
|
|
|
+ v-model="modelCommodity.categoryTwoId"
|
|
|
style="width: 100%"
|
|
|
- @change="changeStockType"
|
|
|
+ @change="handleSearch()"
|
|
|
placeholder="类别" >
|
|
|
<a-select-option
|
|
|
v-for="(item, index) in childStockTypeList"
|
|
|
@@ -208,17 +112,24 @@
|
|
|
v-model="record.sellingPrice"
|
|
|
placeholder="请输入金额"
|
|
|
style="width: 90%"
|
|
|
+ :min="0"
|
|
|
@change="e=>changePrice(e,record)"
|
|
|
/>
|
|
|
</template>
|
|
|
<template slot="numberSlot" slot-scope="text,record">
|
|
|
- <a-input-number
|
|
|
+ <a-input-number :class="record.id"
|
|
|
v-model="record.number"
|
|
|
placeholder="请输入数量"
|
|
|
style="width: 90%"
|
|
|
+ :min="0"
|
|
|
+ :disabled="record.sellingPrice == 0"
|
|
|
@change="e=>changeNumber(e,record)"
|
|
|
/>
|
|
|
</template>
|
|
|
+ <template slot="inventorySlot" slot-scope="text,record">
|
|
|
+ {{record.inventory - record.number}}
|
|
|
+ </template>
|
|
|
+
|
|
|
</a-table>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -240,6 +151,12 @@
|
|
|
type: Boolean,
|
|
|
default: false,
|
|
|
required: false
|
|
|
+ },
|
|
|
+ agreementModel:{
|
|
|
+ type: Object,
|
|
|
+ required: false,
|
|
|
+ default: () => {
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
mixins:[JeecgListMixin, mixinDevice],
|
|
|
@@ -247,10 +164,18 @@
|
|
|
return {
|
|
|
confirmLoading: false,
|
|
|
model: {
|
|
|
- stockType:'',
|
|
|
- amount:0,
|
|
|
+ categoryId:'',
|
|
|
+ payPrice:0,
|
|
|
remarks:'',
|
|
|
- childStockType:'',
|
|
|
+ },
|
|
|
+ modelCommodity:{
|
|
|
+ categoryId:'',
|
|
|
+ categoryTwoId:'',
|
|
|
+ goodsId:'',
|
|
|
+ shopPrice:0,
|
|
|
+ buyNumber:0,
|
|
|
+ amount:0,
|
|
|
+ remarks:'',//协议单位名称+备注
|
|
|
},
|
|
|
labelCol: {
|
|
|
xs: { span: 24 },
|
|
|
@@ -260,12 +185,18 @@
|
|
|
xs: { span: 24 },
|
|
|
sm: { span: 18 },
|
|
|
},
|
|
|
+ validatorRules: {
|
|
|
+ categoryId: [
|
|
|
+ { required: true, message: '请选择消费类目!'},
|
|
|
+ ],
|
|
|
+ },
|
|
|
paymentMethodList: [],
|
|
|
stockTypeList:[],
|
|
|
childStockTypeList:[],
|
|
|
type:1,
|
|
|
url: {
|
|
|
list: "/rooms/cesGoods/queryList",
|
|
|
+ addEntry: "/business/busAgreementOrderFee/addEntry",
|
|
|
},
|
|
|
// 表头
|
|
|
columns: [
|
|
|
@@ -289,9 +220,11 @@
|
|
|
{
|
|
|
title:'剩余库存',
|
|
|
align:"center",
|
|
|
- dataIndex: 'inventory'
|
|
|
+ dataIndex: 'inventory',
|
|
|
+ scopedSlots: { customRender: 'inventorySlot' }
|
|
|
},
|
|
|
],
|
|
|
+ projectName:''
|
|
|
// loading:true,
|
|
|
// dataSource:[]
|
|
|
}
|
|
|
@@ -315,7 +248,9 @@
|
|
|
// this.visible = true;
|
|
|
},
|
|
|
changeStockType(e){
|
|
|
+ this.modelCommodity.categoryTwoId = '';
|
|
|
var _this = this;
|
|
|
+ _this.childStockTypeList = []
|
|
|
httpAction(
|
|
|
"/rooms/cesStockType/getChildTypes?parentId="+e,
|
|
|
{ },
|
|
|
@@ -329,8 +264,8 @@
|
|
|
handleSearch(){
|
|
|
var typeId = "";
|
|
|
var search = "";
|
|
|
- if (this.model.childStockType){
|
|
|
- typeId = this.model.childStockType;
|
|
|
+ if (this.modelCommodity.categoryTwoId){
|
|
|
+ typeId = this.modelCommodity.categoryTwoId;
|
|
|
}
|
|
|
if (this.model.goodsName){
|
|
|
search = this.model.goodsName;
|
|
|
@@ -348,37 +283,63 @@
|
|
|
}
|
|
|
},
|
|
|
submitForm () {
|
|
|
- console.log(9999)
|
|
|
- const that = this;
|
|
|
- that.$emit('ok');
|
|
|
+ var that = this;
|
|
|
+ var categoryIndex = this.stockTypeList.findIndex((s) => s.id == this.model.categoryId);
|
|
|
+ var _projectName = '';
|
|
|
+ if (categoryIndex > 0){
|
|
|
+ _projectName = this.stockTypeList[categoryIndex].name
|
|
|
+ }
|
|
|
+ var goodsList = [];
|
|
|
+ var goodsDataSource = this.dataSource;
|
|
|
+ if (goodsDataSource && goodsDataSource.length > 0){
|
|
|
+ for(let i=0;i<goodsDataSource.length;i++){
|
|
|
+ var item = goodsDataSource[i];
|
|
|
+ if (parseFloat(item.number) > 0 && parseFloat(item.sellingPrice) > 0){
|
|
|
+ var _amount = parseFloat(item.number) * parseFloat(item.sellingPrice);
|
|
|
+ var amount = parseFloat(_amount.toFixed(2));
|
|
|
+ var goodsItem = {
|
|
|
+ categoryId:that.model.categoryId,
|
|
|
+ categoryTwoId:that.modelCommodity.categoryTwoId,
|
|
|
+ goodsId:item.id,
|
|
|
+ shopPrice:item.sellingPrice,
|
|
|
+ buyNumber:item.number,
|
|
|
+ amount:amount,
|
|
|
+ remarks:that.agreementModel.customerName+','+that.model.remarks,//协议单位名称+备注
|
|
|
+ }
|
|
|
+ goodsList.push(goodsItem)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ console.log(goodsList)
|
|
|
// 触发表单验证
|
|
|
- // this.$refs.form.validate(valid => {
|
|
|
- // if (valid) {
|
|
|
- // that.confirmLoading = true;
|
|
|
- // let httpurl = '';
|
|
|
- // let method = '';
|
|
|
- // if(!this.model.id){
|
|
|
- // httpurl+=this.url.add;
|
|
|
- // method = 'post';
|
|
|
- // this.model.hotelId = hotelInfo.id;
|
|
|
- // this.model.agreementId = this.agreementModel.id;
|
|
|
- // }else{
|
|
|
- // httpurl+=this.url.edit;
|
|
|
- // method = 'put';
|
|
|
- // }
|
|
|
- // httpAction(httpurl,this.model,method).then((res)=>{
|
|
|
- // if(res.success){
|
|
|
- // that.$message.success(res.message);
|
|
|
- // that.$emit('ok');
|
|
|
- // }else{
|
|
|
- // // that.$message.warning(res.message);
|
|
|
- // }
|
|
|
- // }).finally(() => {
|
|
|
- // that.confirmLoading = false;
|
|
|
- // })
|
|
|
- // }
|
|
|
- //
|
|
|
- // })
|
|
|
+ this.$refs.form.validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ that.confirmLoading = true;
|
|
|
+ let httpurl = this.url.addEntry;
|
|
|
+ let method = 'post';
|
|
|
+ var data = {
|
|
|
+ agreementUnitId:that.agreementModel.id,
|
|
|
+ categoryId:that.model.categoryId,
|
|
|
+ projectName:_projectName,
|
|
|
+ type:3,
|
|
|
+ payPrice:that.model.payPrice,
|
|
|
+ remarks:that.model.remarks,
|
|
|
+ commodityRecords:goodsList
|
|
|
+ }
|
|
|
+ console.log(data);
|
|
|
+ httpAction(httpurl,data,method).then((res)=>{
|
|
|
+ if(res.success){
|
|
|
+ that.$message.success(res.message);
|
|
|
+ that.$emit('ok');
|
|
|
+ }else{
|
|
|
+ that.$message.warning(res.message);
|
|
|
+ }
|
|
|
+ }).finally(() => {
|
|
|
+ that.confirmLoading = false;
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ })
|
|
|
},
|
|
|
changePrice(e,record){
|
|
|
var _amount = 0;
|
|
|
@@ -387,12 +348,13 @@
|
|
|
for (var i = 0; i < goodsList.length; i++) {
|
|
|
var goods = goodsList[i];
|
|
|
if (parseFloat(goods.number) > 0){
|
|
|
- var money = parseFloat( goods.sellingPrice )* parseFloat(goods.number)
|
|
|
+ var _money = parseFloat( goods.sellingPrice )* parseFloat(goods.number)
|
|
|
+ var money = parseFloat(_money.toFixed(2))
|
|
|
_amount = _amount+ money;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- this.model.amount = _amount;
|
|
|
+ this.model.payPrice = _amount;
|
|
|
},
|
|
|
changeNumber(e,record){
|
|
|
var _amount = 0;
|
|
|
@@ -401,12 +363,14 @@
|
|
|
for (var i = 0; i < goodsList.length; i++) {
|
|
|
var goods = goodsList[i];
|
|
|
if (parseFloat(goods.number) > 0){
|
|
|
- var money = parseFloat( goods.sellingPrice )* parseFloat(goods.number)
|
|
|
+ var _money = parseFloat( goods.sellingPrice )* parseFloat(goods.number)
|
|
|
+ var money = parseFloat(_money.toFixed(2))
|
|
|
_amount = _amount+ money;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- this.model.amount = _amount;
|
|
|
+ console.log(_amount)
|
|
|
+ this.model.payPrice = _amount;
|
|
|
},
|
|
|
}
|
|
|
}
|