WIN-B904R0U0NNS\Administrator 2 lat temu
rodzic
commit
6ae6479376

+ 73 - 18
src/views/markets/modules/agreementUnit/account/goodsConsumeForm.vue

@@ -7,7 +7,7 @@
                         <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="categoryId">
+                                    <a-form-model-item label="消费类目" :labelCol="labelCol1" :wrapperCol="wrapperCol1" prop="categoryId">
                                         <a-select
                                                 v-model="model.categoryId"
                                                 style="width: 90%"
@@ -22,9 +22,9 @@
                                     </a-form-model-item>
                                 </a-col>
                                 <a-col :span="24">
-                                    <a-form-model-item label="消费金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="payPrice">
+                                    <a-form-model-item label="消费金额" :labelCol="labelCol1" :wrapperCol="wrapperCol1" prop="payPrice">
                                         <a-input-number
-                                                disabled
+                                                :disabled="goodsCount > 0"
                                                 v-model="model.payPrice"
                                                 placeholder="请输入金额"
                                                 style="width: 90%"
@@ -32,7 +32,7 @@
                                     </a-form-model-item>
                                 </a-col>
                                 <a-col :span="24">
-                                    <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remarks">
+                                    <a-form-model-item label="备注" :labelCol="labelCol1" :wrapperCol="wrapperCol1" prop="remarks">
                                         <a-textarea
                                                 v-model="model.remarks"
                                                 rows="4"
@@ -47,7 +47,7 @@
                     </j-form-container>
                 </a-spin>
             </div>
-            <div class="right">
+            <div class="right"  v-if="goodsCount > 0">
                 <a-spin :spinning="confirmLoading">
                     <j-form-container>
                         <a-form-model ref="formCommodity" :model="modelCommodity" slot="detail">
@@ -118,12 +118,12 @@
                         </template>
                         <template slot="numberSlot" slot-scope="text,record">
                             <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)"
+                                            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">
@@ -177,6 +177,14 @@
                     amount:0,
                     remarks:'',//协议单位名称+备注
                 },
+                labelCol1: {
+                    xs: { span: 24 },
+                    sm: { span: 3 },
+                },
+                wrapperCol1: {
+                    xs: { span: 24 },
+                    sm: { span: 20 },
+                },
                 labelCol: {
                     xs: { span: 24 },
                     sm: { span: 6 },
@@ -224,7 +232,8 @@
                         scopedSlots: { customRender: 'inventorySlot' }
                     },
                 ],
-                projectName:''
+                projectName:'',
+                goodsCount:0,
                 // loading:true,
                 // dataSource:[]
             }
@@ -259,19 +268,65 @@
                     if (res.success) {
                         _this.childStockTypeList = res.result;
                     }
+                }).finally(() => {
+                    _this.handleSearch(1)
                 });
             },
-            handleSearch(){
+            handleSearch(type) {
                 var typeId = "";
                 var search = "";
-                if (this.modelCommodity.categoryTwoId){
-                    typeId = this.modelCommodity.categoryTwoId;
-                }
-                if (this.model.goodsName){
+                var _this = this;
+
+                if (this.model.goodsName) {
                     search = this.model.goodsName;
                 }
-                this.url.list = "/rooms/cesGoods/queryList?typeId="+typeId+"&search="+search;
+
+                if (type == 1) {
+                    if (this.model.categoryId) {
+                        typeId = this.model.categoryId;
+                    }
+
+                    httpAction(
+                        "/rooms/cesGoods/queryList?typeId=" + typeId + "&search=" + search,
+                        { },
+                        "get"
+                    ).then((res) => {
+                        console.log(res)
+                        if (res.success) {
+                            _this.goodsCount = res.result.length;
+                            console.log(_this.goodsCount)
+                            if (_this.goodsCount > 0){
+                                _this.labelCol1= {
+                                    xs: { span: 24 },
+                                    sm: { span: 8 },
+                                }
+                                _this.wrapperCol1= {
+                                    xs: { span: 24 },
+                                    sm: { span: 14 },
+                                }
+                            }else{
+                                _this.labelCol1= {
+                                    xs: { span: 24 },
+                                    sm: { span: 3 },
+                                }
+                                _this.wrapperCol1= {
+                                    xs: { span: 24 },
+                                    sm: { span: 20 },
+                                }
+                            }
+                        }
+                    }).finally(() => {
+                    });
+                } else {
+                    if (this.modelCommodity.categoryTwoId) {
+                        typeId = this.modelCommodity.categoryTwoId;
+                    }
+                }
+
+                this.url.list = "/rooms/cesGoods/queryList?typeId=" + typeId + "&search=" + search;
+
                 this.loadData(1);
+
             },
             handleChangeType(){
                 if (this.type == 1){

+ 6 - 6
src/views/markets/modules/agreementUnit/agreementAccount.vue

@@ -66,32 +66,32 @@
             </a-row>
         </div>
         <div class="oper">
-            <div class="oper-wrapper" v-if="settleType != 2">
-                <div class="oper-item">
+            <div class="oper-wrapper">
+                <div class="oper-item" v-if="settleType != 2">
                     <a-button @click="handleClick(1)">
                         <a-icon type="file" />
                         商品消费
                     </a-button>
                 </div>
-                <div class="oper-item">
+                <div class="oper-item" v-if="settleType != 2">
                     <a-button @click="handleClick(2)">
                         <a-icon type="file" />
                         入账
                     </a-button>
                 </div>
-                <div class="oper-item">
+                <div class="oper-item" v-if="settleType == 1">
                     <a-button @click="handleClick(3)">
                         <a-icon type="file" />
                         转账
                     </a-button>
                 </div>
-                <div class="oper-item">
+                <div class="oper-item" v-if="settleType == 1">
                     <a-button @click="handleClick(4)">
                         <a-icon type="file" />
                         结算
                     </a-button>
                 </div>
-                <div class="oper-item">
+                <div class="oper-item" v-if="settleType == 1">
                     <a-button @click="handleClick(5)">
                         <a-icon type="file" />
                         冲账