Explorar o código

报价单发起

lxf %!s(int64=2) %!d(string=hai) anos
pai
achega
707aca5dc0

+ 634 - 218
src/components/process/PriceSheet.vue

@@ -1,110 +1,372 @@
 <template>
   <div style="width: 100%; padding: 0px 15px">
     <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
-      <template #deadline>
-        <div>
-          <el-date-picker v-model="formData.data.deadline" type="date" placeholder="请选择付款期限" value-format="YYYY-MM-DD" />
-        </div>
-      </template>
-      <template #receiptsNum>
-        <div>
-          <el-input-number v-model="formData.data.receiptsNum" placeholder="请输入单据数量" :min="0" :precision="0" :controls="false" />
+      <template #seller>
+        <div style="width: 100%">
+          <el-form-item prop="sellCorporationId">
+            <el-select v-model="formData.data.sellCorporationId" style="width: 100%" disabled>
+              <el-option v-for="item in corporationList" :key="item.value" :label="item.label" :value="item.value" />
+            </el-select>
+          </el-form-item>
+          <el-row style="margin-top: 20px; width: 100%">
+            <el-col :span="8">
+              <el-form-item label="地址" prop="sellCountryId">
+                <el-select v-model="formData.data.sellCountryId" placeholder="国家" disabled>
+                  <el-option v-for="item in sellCountryData" :label="item.chineseName" :value="item.id"> </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label=" " prop="sellProvinceId">
+                <el-select v-model="formData.data.sellProvinceId" placeholder="省/洲" disabled>
+                  <el-option v-for="item in sellProvinceData" :label="item.name" :value="item.id"> </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label=" " prop="sellCityId">
+                <el-select v-model="formData.data.sellCityId" placeholder="城市" disabled>
+                  <el-option v-for="item in sellCityData" :label="item.name" :value="item.id"> </el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row style="margin-top: 20px; width: 100%">
+            <el-col :span="24">
+              <el-form-item prop="sellAddress">
+                <el-input v-model="formData.data.sellAddress" type="textarea" disabled> </el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row style="margin-top: 20px; width: 100%">
+            <el-col :span="8">
+              <el-form-item label="联系人" prop="sellContactName">
+                <el-input v-model="formData.data.sellContactName" placeholder="请输入联系人" disabled />
+              </el-form-item>
+            </el-col>
+            <el-col :span="16">
+              <el-form-item label=" " prop="sellContactNumber">
+                <el-input v-model="formData.data.sellContactNumber" placeholder="请输入联系人电话" disabled />
+              </el-form-item>
+            </el-col>
+          </el-row>
         </div>
       </template>
-      <template #fileList>
+      <template #buyer>
         <div style="width: 100%">
-          <el-upload
-            v-model:fileList="fileList"
-            action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
-            multiple
-            :data="uploadData"
-            :before-upload="uploadFile"
-            :on-preview="onPreviewFile">
-            <el-button>选择</el-button>
-          </el-upload>
+          <div style="width: 100%">
+            <el-form-item prop="buyCorporationId">
+              <el-select v-model="formData.data.buyCorporationId" style="width: 100%" @change="changeCustomer">
+                <el-option v-for="item in customerList" :key="item.value" :label="item.label" :value="item.value" />
+              </el-select>
+            </el-form-item>
+            <el-row style="margin-top: 20px; width: 100%">
+              <el-col :span="6">
+                <el-form-item label="地址" prop="buyCountryId">
+                  <el-select v-model="formData.data.buyCountryId" placeholder="国家" @change="(val) => getCityData(val, '20', true)">
+                    <el-option v-for="item in countryData" :label="item.chineseName" :value="item.id"> </el-option>
+                  </el-select>
+                </el-form-item>
+              </el-col>
+              <el-col :span="6">
+                <el-form-item label=" " prop="buyProvinceId">
+                  <el-select v-model="formData.data.buyProvinceId" placeholder="省/洲" @change="(val) => getCityData(val, '30', true)">
+                    <el-option v-for="item in provinceData" :label="item.name" :value="item.id"> </el-option>
+                  </el-select>
+                </el-form-item>
+              </el-col>
+              <el-col :span="6">
+                <el-form-item label=" " prop="buyCityId">
+                  <el-select v-model="formData.data.buyCityId" placeholder="城市">
+                    <el-option v-for="item in cityData" :label="item.name" :value="item.id"> </el-option>
+                  </el-select>
+                </el-form-item>
+              </el-col>
+              <el-col :span="6">
+                <el-form-item label=" " prop="buyPostalCode">
+                  <el-input v-model="formData.data.buyPostalCode" placeholder="请输入邮编" />
+                </el-form-item>
+              </el-col>
+            </el-row>
+            <el-row style="margin-top: 20px; width: 100%">
+              <el-col :span="24">
+                <el-form-item prop="buyAddress">
+                  <el-input v-model="formData.data.buyAddress" type="textarea"> </el-input>
+                </el-form-item>
+              </el-col>
+            </el-row>
+            <el-row style="margin-top: 20px; width: 100%">
+              <el-col :span="8">
+                <el-form-item label="联系人" prop="buyContactName">
+                  <el-autocomplete
+                    v-model="formData.data.buyContactName"
+                    :fetch-suggestions="querySearchPerson"
+                    clearable
+                    class="inline-input w-50"
+                    placeholder="请输入联系人"
+                    @select="handlePerson">
+                  </el-autocomplete>
+                </el-form-item>
+              </el-col>
+              <el-col :span="16">
+                <el-form-item label=" " prop="buyContactNumber">
+                  <el-input v-model="formData.data.buyContactNumber" placeholder="请输入联系人电话" />
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </div>
         </div>
       </template>
-      <template #payDetailList>
+      <template #commodity>
         <div style="width: 100%">
-          <el-button type="primary" @click="clickAdd()">添加行</el-button>
-          <el-table :data="formData.data.payDetailList" style="width: 100%; margin-top: 16px">
-            <el-table-column label="采购合同" width="220">
+          <el-button @click="openProduct = true">添加商品</el-button>
+          <el-table :data="formData.data.quotationProductList" style="width: 100%; margin-top: 16px">
+            <el-table-column label="商品图片" width="80">
+              <template #default="{ row }">
+                <div v-if="row.productId">
+                  <img :src="row.fileUrl" class="pic" @click="onPicture(row.fileUrl)" />
+                </div>
+                <div v-else></div>
+              </template>
+            </el-table-column>
+            <el-table-column prop="code" label="商品编码" width="120" />
+            <el-table-column label="商品名称">
               <template #default="{ row, $index }">
                 <div style="width: 100%">
-                  <el-form-item :prop="'payDetailList.' + $index + '.purchaseId'" :rules="rules.purchaseId" :inline-message="true">
-                    <el-select v-model="row.purchaseId" placeholder="请选择采购合同" style="width: 100%" @change="changePurchaseId(row)">
-                      <el-option v-for="item in contractList" :key="item.value" :label="item.label" :value="item.value" />
-                    </el-select>
+                  <el-form-item :prop="'quotationProductList.' + $index + '.productName'" :rules="rules.productName" :inline-message="true">
+                    <el-input v-model="row.productName" placeholder="请输入商品名称" />
                   </el-form-item>
                 </div>
               </template>
             </el-table-column>
-            <el-table-column prop="amount" label="合同金额" width="140" />
-            <el-table-column prop="sumPayMoney" label="已收发票金额" width="140" />
-            <el-table-column label="款项说明">
+            <el-table-column label="规格型号" width="180">
               <template #default="{ row, $index }">
                 <div style="width: 100%">
-                  <el-form-item :prop="'payDetailList.' + $index + '.remark'" :rules="rules.remark" :inline-message="true">
-                    <el-input v-model="row.remark" placeholder="请输入款项说明" style="width: 100%" />
+                  <el-form-item :prop="'quotationProductList.' + $index + '.productModel'" :rules="rules.productModel" :inline-message="true">
+                    <el-input v-model="row.productModel" placeholder="请输入规格型号" />
                   </el-form-item>
                 </div>
               </template>
             </el-table-column>
-            <el-table-column label="付款金额" width="180">
+            <el-table-column prop="unit" label="单位" width="100" />
+            <el-table-column label="数量" width="160">
               <template #default="{ row, $index }">
                 <div style="width: 100%">
-                  <el-form-item :prop="'payDetailList.' + $index + '.money'" :rules="rules.money" :inline-message="true">
+                  <el-form-item :prop="'quotationProductList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
                     <el-input-number
-                      v-model="row.money"
-                      placeholder="请输入金额"
+                      v-model="row.quantity"
+                      placeholder="请输入数量"
+                      style="width: 100%"
+                      :precision="0"
+                      :controls="false"
+                      :min="0"
+                      @change="calculationAmount()" />
+                  </el-form-item>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="单价" width="160">
+              <template #default="{ row, $index }">
+                <div style="width: 100%">
+                  <el-form-item :prop="'quotationProductList.' + $index + '.price'" :rules="rules.price" :inline-message="true">
+                    <el-input-number
+                      v-model="row.price"
+                      placeholder="请输入单价"
                       style="width: 100%"
                       :precision="2"
                       :controls="false"
                       :min="0"
-                      :disabled="row.id"
-                      @change="changeMoney()" />
+                      @change="calculationAmount()" />
                   </el-form-item>
                 </div>
               </template>
             </el-table-column>
+            <el-table-column prop="amount" label="金额" width="140" />
             <el-table-column label="操作" width="80">
               <template #default="{ row, $index }">
                 <el-button type="primary" link @click="handleRemove($index)">删除</el-button>
               </template>
             </el-table-column>
           </el-table>
-          <br />
+        </div>
+      </template>
+      <template #otherCharge>
+        <div style="width: 100%">
+          <el-button type="primary" @click="clickAdd()">添加行</el-button>
+          <el-table :data="formData.data.quotationPayList" style="width: 100%; margin-top: 16px">
+            <el-table-column label="收费项目" width="220">
+              <template #default="{ row, $index }">
+                <div style="width: 100%">
+                  <el-form-item :prop="'quotationPayList.' + $index + '.payName'" :rules="rules.payName" :inline-message="true">
+                    <el-autocomplete
+                      v-model="row.payName"
+                      :fetch-suggestions="querySearch"
+                      clearable
+                      class="inline-input w-50"
+                      placeholder="请输入收费项目"
+                      @select="
+                        (item) => {
+                          return handleName(item, row);
+                        }
+                      ">
+                    </el-autocomplete>
+                  </el-form-item>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="金额" width="180">
+              <template #default="{ row, $index }">
+                <div style="width: 100%">
+                  <el-form-item :prop="'quotationPayList.' + $index + '.amount'" :rules="rules.amount" :inline-message="true">
+                    <el-input-number
+                      v-model="row.amount"
+                      placeholder="请输入金额"
+                      style="width: 100%"
+                      :precision="2"
+                      :controls="false"
+                      :min="0"
+                      @change="totalAmount()" />
+                  </el-form-item>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="备注">
+              <template #default="{ row, $index }">
+                <div style="width: 100%">
+                  <el-form-item :prop="'quotationPayList.' + $index + '.remark'">
+                    <el-input v-model="row.remark" placeholder="请输入备注" />
+                  </el-form-item>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column label="操作" width="80">
+              <template #default="{ row, $index }">
+                <el-button type="primary" link @click="handleDelete($index)">删除</el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
+      </template>
+      <template #offerMoney>
+        <div style="width: 100%">
+          <el-row style="margin-top: 20px; width: 100%">
+            <el-col :span="4">
+              <el-form-item label="币种" prop="currency">
+                <el-select v-model="formData.data.currency" placeholder="请选择币种" style="width: 100%">
+                  <el-option v-for="item in accountCurrency" :key="item.value" :label="item.label" :value="item.value" />
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="6">
+              <el-form-item label="合同总金额" prop="amount">
+                <el-input v-model="formData.data.amount" placeholder="合同总金额" disabled />
+              </el-form-item>
+            </el-col>
+            <el-col :span="4">
+              <el-form-item label="报价有效期 (天)" prop="effective">
+                <el-input-number v-model="formData.data.effective" placeholder="请输入有效期" style="width: 100%" :precision="0" :controls="false" :min="0" />
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row style="margin-top: 20px; width: 100%">
+            <el-col :span="7">
+              <el-form-item label="付款方式" prop="paymentMethod">
+                <el-select v-model="formData.data.paymentMethod" placeholder="请选择付款方式" style="width: 100%">
+                  <el-option v-for="item in fundsPaymentMethod" :key="item.value" :label="item.label" :value="item.value" />
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="7">
+              <el-form-item label="预付比例 (%)" prop="advanceRatio">
+                <el-input-number
+                  v-model="formData.data.advanceRatio"
+                  placeholder="请输入预付比例"
+                  style="width: 100%"
+                  :precision="2"
+                  :controls="false"
+                  :min="0"
+                  :max="100" />
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </div>
+      </template>
+      <template #delivery>
+        <div style="width: 100%">
+          <el-row style="margin-top: 20px; width: 100%">
+            <el-col :span="7">
+              <el-form-item label="贸易方式" prop="tradeMethods">
+                <el-select v-model="formData.data.tradeMethods" placeholder="请选择贸易方式" style="width: 100%">
+                  <el-option v-for="item in tradeMethods" :key="item.value" :label="item.label" :value="item.value" />
+                </el-select>
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row style="margin-top: 20px; width: 100%">
+            <el-col :span="7">
+              <el-form-item label="运输方式" prop="transportMethod">
+                <el-select v-model="formData.data.transportMethod" placeholder="请选择运输方式" style="width: 100%">
+                  <el-option v-for="item in shippingMethod" :key="item.value" :label="item.label" :value="item.value" />
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="7">
+              <el-form-item label="运输说明" prop="transportRemark">
+                <el-input v-model="formData.data.transportRemark" placeholder="请输入运输说明" />
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row style="margin-top: 20px; width: 100%">
+            <el-col :span="14">
+              <el-form-item label="付款条件" prop="remark">
+                <el-input v-model="formData.data.remark" :rows="2" type="textarea" placeholder="请输入付款条件" />
+              </el-form-item>
+            </el-col>
+          </el-row>
+          <el-row style="margin-top: 20px; width: 100%">
+            <el-col :span="7">
+              <el-form-item label="保质期 (天)" prop="warranty">
+                <el-input-number v-model="formData.data.warranty" placeholder="请输入保质期" style="width: 100%" :precision="0" :controls="false" :min="0" />
+              </el-form-item>
+            </el-col>
+          </el-row>
         </div>
       </template>
     </byForm>
+
+    <el-dialog v-model="openProduct" title="选择商品" width="70%" append-to-body>
+      <SelectGoods @cancel="openProduct = false" @pushGoods="pushGoods"></SelectGoods>
+    </el-dialog>
   </div>
 </template>
 
 <script setup>
 import byForm from "@/components/byForm/index";
-import { ElMessage } from "element-plus";
 import useUserStore from "@/store/modules/user";
+import SelectGoods from "@/components/product/SelectGoods";
+import { ElMessage } from "element-plus";
 
 const { proxy } = getCurrentInstance();
-const supplierList = ref([]);
-const invoiceType = ref([]);
+const accountCurrency = ref([]);
 const fundsPaymentMethod = ref([]);
-const accountList = ref([]);
-const contractList = ref([]);
+const tradeMethods = ref([]);
+const shippingMethod = ref([]);
+const templateList = ref([]);
+const corporationList = ref([]);
+const customerList = ref([]);
+const sellCountryData = ref([]);
+const sellProvinceData = ref([]);
+const sellCityData = ref([]);
+const countryData = ref([]);
+const provinceData = ref([]);
+const cityData = ref([]);
+const customerUserList = ref([]);
+const openProduct = ref(false);
 let formData = reactive({
   data: {
-    supplyId: "",
-    amount: "",
-    invoiceType: "",
-    remark: "",
-    deadline: "",
-    receiptsNum: undefined,
-    payType: "",
-    currency: "",
-    accountManagementId: "",
-    userName: "",
-    payDetailList: [],
-    fileList: [],
+    amount: undefined,
+    quotationProductList: [],
+    quotationPayList: [],
   },
 });
 const submit = ref(null);
@@ -117,138 +379,85 @@ const formOption = reactive({
 const formConfig = computed(() => {
   return [
     {
-      label: "基础信息",
+      label: "合同模板",
     },
     {
       type: "select",
-      label: "供应商",
-      prop: "supplyId",
-      data: supplierList.value,
+      label: "选择合同模板",
+      prop: "contractTemplateId",
+      data: templateList.value,
       fn: (val) => {
-        changeSupply(val);
+        changeTemplate(val);
       },
     },
     {
       type: "slot",
-      prop: "deadline",
-      slotName: "deadline",
-      label: "付款期限",
+      slotName: "seller",
+      label: "卖方信息",
       itemWidth: 50,
     },
     {
-      type: "select",
-      label: "发票类型",
-      prop: "invoiceType",
-      data: invoiceType.value,
+      type: "slot",
+      slotName: "buyer",
+      label: "买方信息",
       itemWidth: 50,
     },
     {
-      type: "input",
-      prop: "remark",
-      label: "付款说明",
-      itemType: "textarea",
-    },
-    {
       type: "slot",
-      prop: "receiptsNum",
-      slotName: "receiptsNum",
-      label: "单据数量",
+      slotName: "commodity",
+      label: "商品信息",
     },
     {
       type: "slot",
-      prop: "fileList",
-      slotName: "fileList",
-      label: "上传附件",
+      slotName: "otherCharge",
+      label: "其他收费项目",
     },
     {
       type: "slot",
-      prop: "payDetailList",
-      slotName: "payDetailList",
-      label: "付款明细",
-    },
-    {
-      type: "input",
-      prop: "amount",
-      label: "付款总额",
-      required: true,
-      itemType: "text",
-      disabled: true,
-    },
-    {
-      label: "收款信息",
-    },
-    {
-      type: "select",
-      label: "付款方式",
-      prop: "payType",
-      data: fundsPaymentMethod.value,
-      itemWidth: 50,
-    },
-    {
-      type: "select",
-      label: "付款账户",
-      prop: "accountManagementId",
-      data: accountList.value,
-      itemWidth: 50,
-      fn: (val) => {
-        changeAccount(val);
-      },
-    },
-    {
-      type: "input",
-      prop: "bankName",
-      label: "户名",
-      required: true,
-      itemType: "text",
-      itemWidth: 50,
+      slotName: "offerMoney",
+      label: "报价金额",
     },
     {
-      type: "input",
-      prop: "accountOpening",
-      label: "银行账号",
-      required: true,
-      itemType: "text",
-      itemWidth: 50,
-    },
-    {
-      type: "input",
-      prop: "openingBank",
-      label: "开户银行",
-      required: true,
-      itemType: "text",
-      itemWidth: 50,
-    },
-    {
-      type: "input",
-      prop: "interbankNumber",
-      label: "联行号",
-      required: true,
-      itemType: "text",
-      itemWidth: 50,
+      type: "slot",
+      slotName: "delivery",
+      label: "交付信息",
     },
   ];
 });
 const rules = ref({
-  supplyId: [{ required: true, message: "请选择供应商", trigger: "change" }],
-  invoiceType: [{ required: true, message: "请选择发票类型", trigger: "change" }],
-  payType: [{ required: true, message: "请选择付款方式", trigger: "change" }],
-  accountManagementId: [{ required: true, message: "请选择付款账户", trigger: "change" }],
-  purchaseId: [{ required: true, message: "请选择采购合同", trigger: "change" }],
-  money: [{ required: true, message: "请输入付款金额", trigger: "blur" }],
+  contractTemplateId: [{ required: true, message: "请选择合同模板", trigger: "change" }],
+  buyCorporationId: [{ required: true, message: "请选择公司", trigger: "change" }],
+  buyCountryId: [{ required: true, message: "请选择国家", trigger: "change" }],
+  buyProvinceId: [{ required: true, message: "请选择省/州", trigger: "change" }],
+  buyCityId: [{ required: true, message: "请选择城市", trigger: "change" }],
+  buyAddress: [{ required: true, message: "请输入详细地址", trigger: "blur" }],
+  buyContactName: [{ required: true, message: "请输入联系人", trigger: ["change", "blur"] }],
+  buyContactNumber: [{ required: true, message: "请输入联系电话", trigger: "blur" }],
+  productName: [{ required: true, message: "请输入商品名称", trigger: "blur" }],
+  productModel: [{ required: true, message: "请输入规格型号", trigger: "blur" }],
+  quantity: [{ required: true, message: "请输入数量", trigger: "blur" }],
+  amount: [{ required: true, message: "请输入金额", trigger: "blur" }],
+  payName: [{ required: true, message: "请输入收费项目", trigger: ["change", "blur"] }],
+  currency: [{ required: true, message: "请选择币种", trigger: "change" }],
+  effective: [{ required: true, message: "请输入报价有效期", trigger: "blur" }],
+  paymentMethod: [{ required: true, message: "请选择付款方式", trigger: "change" }],
+  advanceRatio: [{ required: true, message: "请输入预付比例", trigger: "blur" }],
+  tradeMethods: [{ required: true, message: "请选择贸易方式", trigger: "change" }],
+  transportMethod: [{ required: true, message: "请选择运输方式", trigger: "change" }],
+  transportRemark: [{ required: true, message: "请输入运输说明", trigger: "blur" }],
+  remark: [{ required: true, message: "请输入付款条件", trigger: "blur" }],
 });
-const fileList = ref([]);
-const uploadData = ref({});
 const getDict = () => {
   proxy
     .post("/dictTenantData/page", {
       pageNum: 1,
       pageSize: 999,
-      dictCode: "invoice_type",
+      dictCode: "account_currency",
       tenantId: useUserStore().user.tenantId,
     })
     .then((res) => {
       if (res.rows && res.rows.length > 0) {
-        invoiceType.value = res.rows.map((item) => {
+        accountCurrency.value = res.rows.map((item) => {
           return {
             label: item.dictValue,
             value: item.dictKey,
@@ -273,105 +482,305 @@ const getDict = () => {
         });
       }
     });
-  proxy.post("/supplierInfo/page", { pageNum: 1, pageSize: 999 }).then((res) => {
-    if (res.rows && res.rows.length > 0) {
-      supplierList.value = res.rows.map((item) => {
-        return {
-          label: item.name,
-          value: item.id,
-        };
-      });
-    }
+  proxy
+    .post("/dictTenantData/page", {
+      pageNum: 1,
+      pageSize: 999,
+      dictCode: "trade_methods",
+      tenantId: useUserStore().user.tenantId,
+    })
+    .then((res) => {
+      if (res.rows && res.rows.length > 0) {
+        tradeMethods.value = res.rows.map((item) => {
+          return {
+            label: item.dictValue,
+            value: item.dictKey,
+          };
+        });
+      }
+    });
+  proxy
+    .post("/dictTenantData/page", {
+      pageNum: 1,
+      pageSize: 999,
+      dictCode: "shipping_method",
+      tenantId: useUserStore().user.tenantId,
+    })
+    .then((res) => {
+      if (res.rows && res.rows.length > 0) {
+        shippingMethod.value = res.rows.map((item) => {
+          return {
+            label: item.dictValue,
+            value: item.dictKey,
+          };
+        });
+      }
+    });
+  proxy.post("/contractTemplate/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+    templateList.value = res.rows.map((item) => {
+      return {
+        ...item,
+        label: item.templateName,
+        value: item.id,
+      };
+    });
   });
-  proxy.post("/accountManagement/page", { pageNum: 1, pageSize: 999 }).then((res) => {
-    accountList.value = res.rows.map((item) => {
+  proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+    corporationList.value = res.rows.map((item) => {
       return {
-        bankName: item.name,
-        accountOpening: item.accountOpening,
-        openingBank: item.openingBank,
-        interbankNumber: item.interbankNumber,
-        label: item.alias,
+        ...item,
+        label: item.name,
+        value: item.id,
+      };
+    });
+  });
+  proxy.post("/customer/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+    customerList.value = res.rows.map((item) => {
+      return {
+        ...item,
+        label: item.name,
         value: item.id,
       };
     });
   });
 };
 getDict();
-const uploadFile = async (file) => {
-  const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
-  uploadData.value = res.uploadBody;
-  file.id = res.id;
-  file.fileName = res.fileName;
-  file.fileUrl = res.fileUrl;
-  return true;
+const getSellCityData = (id, type, isChange) => {
+  proxy.post("/areaInfo/list", { parentId: id }).then((res) => {
+    if (type === "20") {
+      sellProvinceData.value = res;
+      if (isChange) {
+        formData.data.provinceId = "";
+        formData.data.cityId = "";
+      }
+    } else if (type === "30") {
+      sellCityData.value = res;
+      if (isChange) {
+        formData.data.cityId = "";
+      }
+    } else {
+      sellCountryData.value = res;
+    }
+  });
 };
-const onPreviewFile = (file) => {
-  window.open(file.raw.fileUrl, "_blank");
+getSellCityData("0");
+const changeTemplate = (val) => {
+  if (val) {
+    proxy.post("/contractTemplate/detail", { id: val }).then(
+      (res) => {
+        formData.data.sellCorporationId = res.corporationId;
+        formData.data.sellContactName = res.contactName;
+        formData.data.sellContactNumber = res.contactNumber;
+        formData.data.sellCountryId = res.countryId;
+        formData.data.sellProvinceId = res.provinceId;
+        formData.data.sellCityId = res.cityId;
+        formData.data.sellAddress = res.address;
+        getSellCityData(formData.data.sellCountryId, "20");
+        getSellCityData(formData.data.sellProvinceId, "30");
+      },
+      (err) => {
+        console.log(err);
+        formData.data.sellCorporationId = "";
+        formData.data.sellContactName = "";
+        formData.data.sellContactNumber = "";
+        formData.data.sellCountryId = "";
+        formData.data.sellProvinceId = "";
+        formData.data.sellCityId = "";
+        formData.data.sellAddress = "";
+      }
+    );
+  } else {
+    formData.data.sellCorporationId = "";
+    formData.data.sellContactName = "";
+    formData.data.sellContactNumber = "";
+    formData.data.sellCountryId = "";
+    formData.data.sellProvinceId = "";
+    formData.data.sellCityId = "";
+    formData.data.sellAddress = "";
+  }
+};
+const getCityData = (id, type, isChange) => {
+  proxy.post("/areaInfo/list", { parentId: id }).then((res) => {
+    if (type === "20") {
+      provinceData.value = res;
+      if (isChange) {
+        formData.data.provinceId = "";
+        formData.data.cityId = "";
+      }
+    } else if (type === "30") {
+      cityData.value = res;
+      if (isChange) {
+        formData.data.cityId = "";
+      }
+    } else {
+      countryData.value = res;
+    }
+  });
 };
-const changeSupply = (val) => {
+const changeCustomer = (val) => {
+  formData.data.buyContactName = "";
+  formData.data.buyContactNumber = "";
   if (val) {
-    proxy.get("/purchase/getListBySupplyId", { supplyId: val }).then((res) => {
-      if (res.data && res.data.length > 0) {
-        contractList.value = res.data.map((item) => {
-          return {
-            value: item.id,
-            label: item.code,
-            amount: item.amount,
-            sumPayMoney: item.sumPayMoney,
-          };
-        });
-      } else {
-        contractList.value = [];
+    proxy.post("/customer/detail", { id: val }).then(
+      (res) => {
+        if (res.customerUserList && res.customerUserList.length > 0) {
+          formData.data.buyContactName = res.customerUserList[0].name;
+          formData.data.buyContactNumber = res.customerUserList[0].phone;
+          customerUserList.value = res.customerUserList.map((item) => {
+            return {
+              ...item,
+              value: item.name,
+            };
+          });
+        }
+        formData.data.buyCountryId = res.countryId;
+        formData.data.buyProvinceId = res.provinceId;
+        formData.data.buyCityId = res.cityId;
+        formData.data.buyPostalCode = res.zipCode;
+        formData.data.buyAddress = res.address;
+        getCityData(formData.data.buyCountryId, "20");
+        getCityData(formData.data.buyProvinceId, "30");
+      },
+      (err) => {
+        console.log(err);
+        formData.data.buyCountryId = "";
+        formData.data.buyProvinceId = "";
+        formData.data.buyCityId = "";
+        formData.data.buyPostalCode = "";
+        formData.data.buyAddress = "";
       }
-    });
+    );
   } else {
-    contractList.value = [];
+    formData.data.buyCountryId = "";
+    formData.data.buyProvinceId = "";
+    formData.data.buyCityId = "";
+    formData.data.buyPostalCode = "";
+    formData.data.buyAddress = "";
   }
 };
-const clickAdd = () => {
-  if (formData.data.payDetailList && formData.data.payDetailList.length > 0) {
-    formData.data.payDetailList.push({ purchaseId: "", money: undefined, remark: "" });
+const createFilter = (queryString) => {
+  return (restaurant) => {
+    return restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0;
+  };
+};
+const querySearchPerson = (queryString, callback) => {
+  const results = queryString ? customerUserList.value.filter(createFilter(queryString)) : customerUserList.value;
+  callback(results);
+};
+const handlePerson = (item) => {
+  formData.data.buyContactNumber = item.phone;
+};
+const pushGoods = (goods) => {
+  if (goods && goods.length > 0) {
+    formData.data.quotationProductList = formData.data.quotationProductList.concat(
+      goods.map((item) => {
+        let fileUrl = "";
+        if (item.fileList && item.fileList.length > 0) {
+          fileUrl = item.fileList[0].fileUrl;
+        }
+        return {
+          fileUrl: fileUrl,
+          code: item.code,
+          productId: item.id,
+          productName: item.name,
+          productModel: item.spec,
+          unit: item.unit,
+          quantity: undefined,
+          price: undefined,
+          amount: "",
+          remark: item.remark,
+        };
+      })
+    );
+    ElMessage({
+      message: "添加成功!",
+      type: "success",
+    });
+    openProduct.value = false;
   } else {
-    formData.data.payDetailList = [{ purchaseId: "", money: undefined, remark: "" }];
+    ElMessage("请选择至少一件商品");
   }
 };
+const onPicture = (path) => {
+  window.open(path, "_blank");
+};
 const handleRemove = (index) => {
-  formData.data.payDetailList.splice(index, 1);
+  formData.data.quotationProductList.splice(index, 1);
 };
-const changeAccount = (val) => {
-  if (val) {
-    let data = accountList.value.filter((item) => item.value === val);
-    if (data && data.length > 0) {
-      formData.data.bankName = data[0].bankName;
-      formData.data.accountOpening = data[0].accountOpening;
-      formData.data.openingBank = data[0].openingBank;
-      formData.data.interbankNumber = data[0].interbankNumber;
+const calculationAmount = () => {
+  nextTick(() => {
+    if (formData.data.quotationProductList && formData.data.quotationProductList.length > 0) {
+      for (let i = 0; i < formData.data.quotationProductList.length; i++) {
+        let money = 0;
+        if (formData.data.quotationProductList[i].quantity && formData.data.quotationProductList[i].price) {
+          money = parseFloat(Number(formData.data.quotationProductList[i].quantity) * Number(formData.data.quotationProductList[i].price)).toFixed(2);
+        }
+        formData.data.quotationProductList[i].amount = money;
+      }
+    }
+    nextTick(() => {
+      totalAmount();
+    });
+  });
+};
+const totalAmount = () => {
+  let money = 0;
+  if (formData.data.quotationProductList && formData.data.quotationProductList.length > 0) {
+    for (let i = 0; i < formData.data.quotationProductList.length; i++) {
+      if (formData.data.quotationProductList[i].amount) {
+        money = parseFloat(Number(money) + Number(formData.data.quotationProductList[i].amount)).toFixed(2);
+      }
+    }
+  }
+  if (formData.data.quotationPayList && formData.data.quotationPayList.length > 0) {
+    for (let i = 0; i < formData.data.quotationPayList.length; i++) {
+      if (formData.data.quotationPayList[i].amount) {
+        money = parseFloat(Number(money) + Number(formData.data.quotationPayList[i].amount)).toFixed(2);
+      }
     }
   }
+  formData.data.amount = money;
 };
-const changePurchaseId = (row) => {
-  let data = contractList.value.filter((item) => item.value === row.purchaseId);
-  if (data && data.length > 0) {
-    row.amount = data[0].amount;
-    row.sumPayMoney = data[0].sumPayMoney;
+const clickAdd = () => {
+  if (formData.data.quotationPayList && formData.data.quotationPayList.length > 0) {
+    formData.data.quotationPayList.push({ payName: "", amount: undefined, remark: "" });
   } else {
-    row.amount = "";
-    row.sumPayMoney = "";
+    formData.data.quotationPayList = [{ payName: "", amount: undefined, remark: "" }];
   }
 };
-const changeMoney = () => {
-  let money = 0;
-  for (let i = 0; i < formData.data.payDetailList.length; i++) {
-    if (formData.data.payDetailList[i].money) {
-      money = parseFloat(Number(money) + Number(formData.data.payDetailList[i].money)).toFixed(2);
+const handleDelete = (index) => {
+  formData.data.quotationPayList.splice(index, 1);
+};
+const querySearch = (queryString, callback) => {
+  proxy.post("/quotationPay/page", { payName: queryString }).then((res) => {
+    if (res.rows && res.rows.length > 0) {
+      res.rows = res.rows.map((item) => {
+        return {
+          ...item,
+          value: item.payName,
+        };
+      });
+      callback(res.rows);
+    } else {
+      callback([]);
     }
-  }
-  formData.data.amount = money;
+  });
+};
+const handleName = (item, row) => {
+  row.amount = item.amount;
+  row.remark = item.remark;
+  nextTick(() => {
+    totalAmount();
+  });
 };
 const handleSubmit = async () => {
   let status = await submit.value.handleSubmit(() => {});
   if (status) {
-    // ElMessage("请添加至少一条付款明细");
+    if (formData.data.quotationProductList && formData.data.quotationProductList.length > 0) {
+      return true;
+    } else {
+      ElMessage("请添加至少一件商品");
+    }
     return false;
   }
   return status;
@@ -387,4 +796,11 @@ defineExpose({
 ::v-deep(.el-input-number .el-input__inner) {
   text-align: left;
 }
+.pic {
+  object-fit: contain;
+  width: 50px;
+  height: 50px;
+  cursor: pointer;
+  vertical-align: middle;
+}
 </style>

+ 2 - 2
src/views/customer/file/index.vue

@@ -26,7 +26,7 @@
     <el-dialog :title="modalType == 'add' ? '新增' : '编辑'" v-model="dialogVisible" width="800" v-loading="loadingOperation">
       <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
         <template #address>
-          <el-row :gutter="10" style="width: 100%">
+          <el-row style="width: 100%">
             <el-col :span="8">
               <el-form-item prop="countryId">
                 <el-select v-model="formData.data.countryId" placeholder="国家" @change="(val) => getCityData(val, '20', true)">
@@ -49,7 +49,7 @@
               </el-form-item>
             </el-col>
           </el-row>
-          <el-row style="margin-top: 20px; width: 100%; margin-left: -10px">
+          <el-row style="margin-top: 20px; width: 100%">
             <el-col :span="24">
               <el-form-item prop="address">
                 <el-input v-model="formData.data.address" type="textarea"> </el-input>

+ 5 - 5
src/views/publicModule/contractTemplate/index.vue

@@ -21,7 +21,7 @@
     <el-dialog :title="modalType == 'add' ? '新增' : '编辑'" v-if="dialogVisible" v-model="dialogVisible" width="800" v-loading="loadingOperation">
       <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
         <template #allAddress>
-          <el-row :gutter="10" style="width: 100%">
+          <el-row style="width: 100%">
             <el-col :span="8">
               <el-form-item prop="countryId">
                 <el-select v-model="formData.data.countryId" placeholder="国家" @change="(val) => getCityData(val, '20', true)">
@@ -53,7 +53,7 @@
           </el-row>
         </template>
         <template #allAddressEnglish>
-          <el-row :gutter="10" style="width: 100%">
+          <el-row style="width: 100%">
             <el-col :span="8">
               <el-form-item prop="countryEnStr">
                 <el-input v-model="formData.data.countryEnStr" placeholder="请输入国家 (英文)" />
@@ -80,7 +80,7 @@
         </template>
         <template #templateContent>
           <div style="width: 100%">
-            <Editor :value="formData.data.templateContent" @updateValue="updateContent"/>
+            <Editor :value="formData.data.templateContent" @updateValue="updateContent" />
           </div>
         </template>
       </byForm>
@@ -369,8 +369,8 @@ const update = (row) => {
   });
 };
 const updateContent = (val) => {
-  formData.data.templateContent = val
-}
+  formData.data.templateContent = val;
+};
 </script>
 
 <style lang="scss" scoped>

+ 27 - 7
src/views/salesMange/saleContract/priceSheet/index.vue

@@ -32,6 +32,7 @@ import useUserStore from "@/store/modules/user";
 
 const { proxy } = getCurrentInstance();
 const accountList = ref([]);
+const corporationList = ref([]);
 const status = ref([
   {
     label: "草稿",
@@ -73,11 +74,11 @@ const selectConfig = computed(() => {
       prop: "status",
       data: status.value,
     },
-    //   {
-    //     label: "归属公司",
-    //     prop: "sellCorporationId",
-    //     data: payStatus.value,
-    //   },
+    {
+      label: "归属公司",
+      prop: "sellCorporationId",
+      data: corporationList.value,
+    },
   ];
 });
 const config = computed(() => {
@@ -92,13 +93,23 @@ const config = computed(() => {
     {
       attrs: {
         label: "归属公司",
-        slot: "sellCorporationId",
+        prop: "sellCorporationId",
+      },
+      render(type) {
+        let text = "";
+        if (corporationList.value && corporationList.value.length > 0) {
+          let data = corporationList.value.filter((item) => item.value == type);
+          if (data && data.length > 0) {
+            text = data[0].label;
+          }
+        }
+        return text;
       },
     },
     {
       attrs: {
         label: "报价人",
-        prop: "sellContactName",
+        prop: "userName",
         width: 120,
       },
     },
@@ -190,6 +201,15 @@ const getDict = () => {
       };
     });
   });
+  proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
+    corporationList.value = res.rows.map((item) => {
+      return {
+        ...item,
+        label: item.name,
+        value: item.id,
+      };
+    });
+  });
 };
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };