Explorar el Código

Merge branch 'master' of http://49.4.53.36:3000/hotel/hotel-saas-tenant-frontend

gqx hace 2 años
padre
commit
a8046e1bbd

+ 3 - 1
src/views/markets/agreementunit.vue

@@ -340,9 +340,11 @@
                 var url = '/tenant/marketinfo/agreementaccount';//'markets/agreementunit/agreementAccount';
                 //缓存选择的协议id
                 console.log(record)
+                localStorage.removeItem("agreementUnitInfo")
                 localStorage.setItem("agreementUnitInfo", JSON.stringify(record))
                 this.$router.push({
-                    path:url
+                    path:url,
+                    query: { agreementUnitInfo: record },
                 });
                 // this.$router.push({
                 //     // path: "/room/scheduledetail",

+ 14 - 4
src/views/markets/modules/agreementUnit/account/accountEnterForm.vue

@@ -19,7 +19,7 @@
         </a-tabs>
         <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="paymentMethod">
@@ -90,7 +90,9 @@
         data () {
             return {
                 confirmLoading: false,
-                model: {},
+                model: {
+                    price:0,
+                },
                 labelCol: {
                     xs: { span: 24 },
                     sm: { span: 3 },
@@ -106,6 +108,11 @@
                 },
                 type:1,
                 paymentMethodList: [],
+                validatorRules: {
+                    // price: [
+                    //     { required: true, message: '请输入金额!'},
+                    // ],
+                },
             }
         },
         created() {
@@ -135,8 +142,11 @@
                 this.type = key
             },
             submitForm(){
-                console.log(888)
                 const that = this;
+                if (that.model.price <= 0){
+                    that.$message.warning("金额需大于0");
+                    return;
+                }
                 // 触发表单验证
                 this.$refs.form.validate(valid => {
                     if (valid) {
@@ -147,7 +157,7 @@
                             agreementUnitId:that.agreementModel.id,
                             projectName:that.type == 1?"预收账款":"预收退款",
                             type:that.type,
-                            payPrice:that.model.price,
+                            payPrice:that.type == 1?that.model.price:that.model.price*(-1),
                             payType:that.model.paymentMethod,
                             remarks:that.model.remarks,
                         }

+ 53 - 5
src/views/markets/modules/agreementUnit/account/accountReverseEntryForm.vue

@@ -1,7 +1,7 @@
 <template>
     <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="price">
@@ -16,6 +16,8 @@
                             <a-input-number
                                     v-model="model.price"
                                     placeholder="请输入金额"
+                                    :min="0"
+                                    :max="maxMoney"
                                     style="width: 30%"
                             />
                         </a-form-model-item>
@@ -43,6 +45,8 @@
 </template>
 
 <script>
+    import { httpAction, getAction } from "@/api/manage";
+
     export default {
         name: 'accountReverseEntryForm',
         props: {
@@ -56,12 +60,20 @@
                 type: Number,
                 default: 200,
                 required: false
-            }
+            },
+            agreementModel:{
+                type: Object,
+                required: false,
+                default: () => {
+                }
+            },
         },
         data () {
             return {
                 confirmLoading: false,
-                model: {},
+                model: {
+                    price:0,
+                },
                 labelCol: {
                     xs: { span: 24 },
                     sm: { span: 3 },
@@ -71,6 +83,14 @@
                     sm: { span: 18 },
                 },
                 paymentMethodList: [],
+                url: {
+                    reverseEntry: "/business/busAgreementOrderFee/reverseEntry",
+                },
+                validatorRules: {
+                    // price: [
+                    //     { required: true, message: '请输入金额!'},
+                    // ],
+                },
             }
         },
         created() {
@@ -83,9 +103,37 @@
                 // this.visible = true;
             },
             submitForm(){
-                console.log(888)
                 const that = this;
-                that.$emit('ok');
+                if (that.model.price <=0){
+                    that.$message.warning("金额需大于0");
+                    return;
+                }
+                // 触发表单验证
+                this.$refs.form.validate(valid => {
+                    if (valid) {
+                        that.confirmLoading = true;
+                        let httpurl = this.url.reverseEntry;
+                        let method = 'post';
+                        var data = {
+                            agreementUnitId:that.agreementModel.id,
+                            projectName:"冲账",
+                            type:6,
+                            payPrice:that.model.price*(-1),
+                            remarks:that.model.remarks,
+                        }
+                        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;
+                        })
+                    }
+                })
             },
         }
     }

+ 24 - 6
src/views/markets/modules/agreementUnit/account/accountTransferForm.vue

@@ -62,8 +62,8 @@
                 default: false,
                 required: false
             },
-            maxMoney: {
-                type: Number,
+            orderIds: {
+                type: String,
                 default: 200,
                 required: false
             }
@@ -108,6 +108,7 @@
                 ],
                 url: {
                     list: "/business/busMarketAgreementUnit/list",
+                    transferBatch: "/business/busAgreementOrderFee/transferBatch",
                 },
             }
         },
@@ -129,11 +130,28 @@
                 // this.changeColumns(this.model.roomType, this.model.fixedDiscount)
                 // this.visible = true;
             },
-            handleTransfer(){
-                console.log('确认转账');
-                this.$message.success("转账成功");
+            handleTransfer(record){
+                console.log(record);
+                console.log(this.orderIds);
                 const that = this;
-                that.$emit('ok');
+                var data = {
+                    agreementUnitId:record.id,
+                    orderIds:that.orderIds
+                }
+                console.log(data);
+                that.confirmLoading = true;
+                let httpurl = this.url.transferBatch;
+                let method = 'post';
+                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;
+                })
             }
         }
     }

+ 2 - 6
src/views/markets/modules/agreementUnit/account/accountTransferModal.vue

@@ -8,7 +8,7 @@
             @ok="handleOk"
             @cancel="handleCancel"
             cancelText="关闭">
-        <account-transfer-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" :maxMoney="maxMoney" :agreementModel="agreementModel"></account-transfer-form>
+        <account-transfer-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" :orderIds="orderIds" :agreementModel="agreementModel"></account-transfer-form>
     </j-modal>
 </template>
 
@@ -26,16 +26,12 @@
                 required: false,
                 default: () => {
                 }
-            },
-            maxMoney: {
-                type: Number,
-                default: 200,
-                required: false
             }
         },
         data () {
             return {
                 title:'',
+                orderIds:'',
                 width:1000,
                 visible: false,
                 disableSubmit: false

+ 1 - 1
src/views/markets/modules/agreementUnit/account/commodityReturn.vue

@@ -155,7 +155,7 @@
                     var data = {
                         id:that.agreementOrderFeeId,
                         type:4,
-                        payPrice:amount,
+                        payPrice:amount*(-1),
                         remarks:that.model.remarks,
                         commodityRecords:goodsList
                     }

+ 5 - 1
src/views/markets/modules/agreementUnit/account/goodsConsumeForm.vue

@@ -50,7 +50,7 @@
             <div class="right">
                 <a-spin :spinning="confirmLoading">
                     <j-form-container>
-                        <a-form-model ref="form" :model="modelCommodity" slot="detail">
+                        <a-form-model ref="formCommodity" :model="modelCommodity" slot="detail">
                             <a-row>
                                 <a-col :span="9" v-if="type == 1">
                                     <a-form-model-item label="" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="categoryTwoId">
@@ -310,6 +310,10 @@
                         }
                     }
                 }
+                if (that.model.payPrice <= 0){
+                    that.$message.warning("没有消费");
+                    return;
+                }
                 console.log(goodsList)
                 // 触发表单验证
                 this.$refs.form.validate(valid => {

+ 3 - 2
src/views/markets/modules/agreementUnit/account/settlementForm.vue

@@ -30,6 +30,7 @@
                             <a-input-number
                                     v-model="model.price"
                                     placeholder="请输入金额"
+                                    :min="0"
                                     style="width: 30%"
                             />
                         </a-form-model-item>
@@ -123,9 +124,9 @@
                 // this.visible = true;
             },
             submitForm(){
-                console.log(this.agreementModel)
+                console.log(this.$parent)
                 const that = this;
-                if(this.model.price != this.maxMoney){
+                if(this.model.price != Math.abs(this.maxMoney)){
                     that.$message.warning("支付金额应等于应收/应退金额");
                     return;
                 }

+ 32 - 27
src/views/markets/modules/agreementUnit/agreementAccount.vue

@@ -150,7 +150,7 @@
                         </a-button>
                     </span>
                     <span v-else>
-                        <span v-if="record.categoryId != null">
+                        <span v-if="record.categoryId != null && record.categoryId.toString().length >0 ">
                             {{record.categoryId_dictText}}
                         </span>
                         <span v-else>
@@ -166,7 +166,10 @@
                         -
                     </span>
                     <span v-else>
-                        <a-tag color="green">
+                        <a-tag color="green"  v-if="record.payPrice >= 0">
+                            {{record.payPrice}}
+                        </a-tag>
+                        <a-tag color="red" v-else>
                             {{record.payPrice}}
                         </a-tag>
                     </span>
@@ -176,8 +179,8 @@
                         <a-tag color="green" v-if="record.type == 1">
                             {{record.payPrice}}
                         </a-tag>
-                        <a-tag color="red" v-if="record.type == 2">
-                            -{{record.payPrice}}
+                        <a-tag color="red" v-else>
+                            {{record.payPrice}}
                         </a-tag>
                     </span>
                     <span v-else>
@@ -238,8 +241,6 @@ export default {
             accountModel: {
                 consume: '0',
                 payment: '0',
-                used: '0',
-                surplus: '0'
             },
             // 表头
             columns: [
@@ -312,54 +313,46 @@ export default {
                 }
             ],
             url: {
-                list: "/business/busAgreementOrderFee/list?status=1",
+                list: "/business/busAgreementOrderFee/list",
                 baseList: "/business/busAgreementOrderFee/list",
                 delete: "/business/busAgreementOrderFee/delete",
                 deleteBatch: "/business/busAgreementOrderFee/deleteBatch",
                 exportXlsUrl: "/business/busAgreementOrderFee/exportXls",
                 importExcelUrl: "business/busAgreementOrderFee/importExcel",
                 revoke: "/business/busAgreementOrderFee/revoke",
+                queryAgreementAccount: "/business/busAgreementOrderFee/queryAgreementAccount",//获取协议单位消费、收款信息
             },
         }
     },
     activated() {
-        console.log(99999)
         var agreementUnitInfo = JSON.parse(localStorage.getItem("agreementUnitInfo"));
         this.agreementUnitInfo = Object.assign({}, agreementUnitInfo);
+        this.url.list = this.url.list +"?status=1&agreementUnitId="+this.agreementUnitInfo.id;
+        this.loadData(1);
         this.$forceUpdate()
     },
     created() {
         var agreementUnitInfo = JSON.parse(localStorage.getItem("agreementUnitInfo"));
         this.agreementUnitInfo = Object.assign({}, agreementUnitInfo);
 
-        var temp = {
-            consume: '20',
-            payment: '0',
-            used: '0',
-            surplus: '0'
-        }
-        this.accountModel = Object.assign({}, temp);
-        // console.log(agreementUnitInfo.customerName)
+        this.getAccount();
+        // this.accountModel = Object.assign({}, {});
     },
     methods: {
         moment,
         onRangeChange(e) {
-            console.log(this.rangeValue);
         },
         onTypeChange(e) {
-            console.log(e);
-            console.log(this.settleType);
             if (this.settleType == 1 || this.settleType == 2){
-                this.url.list = this.url.baseList +"?status="+this.settleType;
+                this.url.list = this.url.baseList +"?status="+this.settleType+"&agreementUnitId="+this.agreementUnitInfo.id;
             }else{
-                this.url.list = this.url.baseList;
+                this.url.list = this.url.baseList+"?status=1&agreementUnitId="+this.agreementUnitInfo.id;
             }
-
             this.loadData(1);
+            this.selectedRowKeys = [];
+            this.selectionRows = [];
         },
         handleClick(type){
-            console.log('当前类型:  '+type);
-            console.log(this.selectedRowKeys)
             if (type == 1){
                 this.$refs.goodsConsumeForm.edit();
                 this.$refs.goodsConsumeForm.title="入账";
@@ -381,6 +374,7 @@ export default {
                 });
                 this.$refs.accountTransferForm.edit();
                 this.$refs.accountTransferForm.title="转账";
+                this.$refs.accountTransferForm.orderIds=ids;
                 this.$refs.accountTransferForm.disableSubmit = true;
             }
             else if(type == 4){
@@ -420,10 +414,11 @@ export default {
             }
         },
         modalFormOk() {
+            this.loadData(1);
+            this.getAccount();
         },
         handleCommodityRecord(record){
             //打开商品消费明细
-            console.log(record)
             this.$refs.commodityRecordForm.show();
             this.$refs.commodityRecordForm.title="详细信息";
             this.$refs.commodityRecordForm.agreementOrderFeeId = record.id;
@@ -431,7 +426,6 @@ export default {
         },
         handleGoodsReturn(record){
             //退货
-            console.log(record)
             this.$refs.commodityReturnForm.show();
             this.$refs.commodityReturnForm.title="退货";
             this.$refs.commodityReturnForm.agreementOrderFeeId = record.id;
@@ -445,17 +439,28 @@ export default {
             var data = {
                 id:record.id
             }
-            console.log(data);
             httpAction(httpurl,data,method).then((res)=>{
                 if(res.success){
                     that.$message.success(res.message);
                     that.$emit('ok');
+                    that.loadData(1);
                 }else{
                     that.$message.warning(res.message);
                 }
             }).finally(() => {
                 that.confirmLoading = false;
             })
+        },
+        getAccount(){
+            var that = this;
+            getAction(this.url.queryAgreementAccount, {
+                agreementUnitId: this.agreementUnitInfo.id,
+            }).then((res) => {
+                console.log(res)
+                if (res.success) {
+                    that.accountModel = res.result;
+                }
+            });
         }
     }
 }