cz hace 1 año
padre
commit
6f2b9bab0f

+ 206 - 1
src/components/process/EHSD/Purchase.vue

@@ -292,6 +292,181 @@
       </template>
       <template #commodity>
         <div
+          style="width: 100%; padding: 15px; border: 1px solid #eee"
+          v-if="
+            formData.data.purchaseProductList &&
+            formData.data.purchaseProductList.length > 0
+          "
+        >
+          <el-row
+            style="
+              margin-bottom: 15px;
+              background: #eeeeee;
+              font-weight: 700;
+              padding: 10px;
+            "
+          >
+            <el-col :span="14">货品信息</el-col>
+            <el-col :span="4"
+              >订单总数:{{ formData.data.purchaseProductList.length }}</el-col
+            >
+            <el-col :span="6">订单总金额:{{ getTotalAmount() }}</el-col>
+          </el-row>
+          <template
+            v-for="(item, index) in formData.data.purchaseProductList"
+            :key="index"
+          >
+            <div style="width: 100%">
+              <el-table
+                :data="item.purchaseProductMountingsList"
+                :style="
+                  index !== formData.data.purchaseProductList.length - 1
+                    ? 'margin-bottom: 15px'
+                    : ''
+                "
+              >
+                <!-- :span-method=" ({ rowIndex, columnIndex }) =>
+                objectSpanMethod(rowIndex, columnIndex, item) " -->
+                <el-table-column label="货品信息" align="left">
+                  <template #default="{ row }">
+                    <div style="display: flex; align-items: center">
+                      <div style="width: 50px; height: 50px">
+                        <img
+                          v-if="row.fileUrl"
+                          :src="row.fileUrl"
+                          class="pic"
+                          @click="onPicture(row.fileUrl)"
+                        />
+                      </div>
+                      <div style="margin-left: 20px">
+                        <div>{{ row.productName }}</div>
+                        <div style="display: flex; color: #999999">
+                          <span
+                            >类型:
+                            {{
+                              dictValueLabel(row.productType, productType)
+                            }}</span
+                          ><span style="margin-left: 20px"
+                            >尺寸:{{ row.productModel }}</span
+                          >
+                        </div>
+                      </div>
+                    </div>
+                  </template>
+                </el-table-column>
+                <el-table-column
+                  label="数量"
+                  align="left"
+                  prop="quantity"
+                  width="180"
+                >
+                  <template #default="{ row, $index }">
+                    <div style="width: 100%" class="removePadding">
+                      <el-form-item
+                        :prop="
+                          'purchaseProductList.' +
+                          index +
+                          '.purchaseProductMountingsList.' +
+                          $index +
+                          '.quantity'
+                        "
+                        :rules="rules.quantity"
+                        :inline-message="true"
+                        @change="
+                          () => {
+                            return changeProductMaterial(index, $index);
+                          }
+                        "
+                      >
+                        <el-input-number
+                          onmousewheel="return false;"
+                          v-model="row.quantity"
+                          placeholder="请输入数量"
+                          :precision="0"
+                          :controls="false"
+                          :min="0"
+                        />
+                      </el-form-item>
+                    </div>
+                  </template>
+                </el-table-column>
+                <el-table-column
+                  label="单价"
+                  align="left"
+                  prop="price"
+                  width="180"
+                >
+                  <template #default="{ row, $index }">
+                    <div style="width: 100%" class="removePadding">
+                      <el-form-item
+                        :prop="
+                          'purchaseProductList.' +
+                          index +
+                          '.purchaseProductMountingsList.' +
+                          $index +
+                          '.price'
+                        "
+                        :rules="rules.price"
+                        :inline-message="true"
+                        @change="
+                          () => {
+                            return changeProductMaterial(index, $index);
+                          }
+                        "
+                      >
+                        <el-input-number
+                          onmousewheel="return false;"
+                          v-model="row.price"
+                          placeholder="请输入单价"
+                          :precision="2"
+                          :controls="false"
+                          :min="0"
+                        />
+                      </el-form-item>
+                    </div>
+                  </template>
+                </el-table-column>
+                <el-table-column
+                  label="金额小计"
+                  align="left"
+                  width="140"
+                  prop="amount"
+                />
+                <el-table-column label="操作" align="center" width="100">
+                  <template #default="{ row, $index }">
+                    <div v-if="$index === 0">
+                      <div>
+                        <el-button
+                          type="primary"
+                          text
+                          @click="handleHandover(item, index)"
+                          >备注</el-button
+                        >
+                      </div>
+                      <div>
+                        <el-button
+                          type="primary"
+                          text
+                          @click="handleMaterial(index)"
+                          >添加配件</el-button
+                        >
+                      </div>
+                    </div>
+                    <div v-else>
+                      <el-button
+                        type="primary"
+                        link
+                        @click="handleRemove(index, $index)"
+                        >删除</el-button
+                      >
+                    </div>
+                  </template>
+                </el-table-column>
+              </el-table>
+            </div>
+          </template>
+        </div>
+        <!-- <div 
           style="width: 100%"
           v-if="
             formData.data.purchaseProductList &&
@@ -511,7 +686,7 @@
               </div>
             </div>
           </div>
-        </div>
+        </div> -->
       </template>
       <template #otherCharge>
         <div style="width: 100%">
@@ -1899,6 +2074,36 @@ const remoteMethod = (keyword) => {
   }
   return;
 };
+
+const objectSpanMethod = (rowIndex, columnIndex, item) => {
+  if (columnIndex === 3) {
+    if (rowIndex === 0) {
+      return {
+        rowspan: item.purchaseProductMountingsList.length,
+        colspan: 1,
+      };
+    } else {
+      return {
+        rowspan: 0,
+        colspan: 1,
+      };
+    }
+  }
+};
+
+const getTotalAmount = () => {
+  const total = formData.data.purchaseProjectList.reduce(
+    (val, x) => (val += Number(x.amount)),
+    0
+  );
+  if (total) {
+    return parseFloat(formData.data.amount - total).toFixed(2);
+  } else {
+    if (formData.data.amount) {
+      return parseFloat(formData.data.amount).toFixed(2);
+    }
+  }
+};
 </script>
 
 <style lang="scss" scoped>

+ 12 - 29
src/views/salesMange/saleContract/contractSelect/index.vue

@@ -9,7 +9,8 @@
         :selectConfig="selectConfig"
         highlight-current-row
         :action-list="[]"
-        @get-list="getList">
+        @get-list="getList"
+      >
         <template #amount="{ item }">
           <div>
             <span style="padding-right: 4px">{{ item.currency }}</span>
@@ -41,7 +42,6 @@ import { ElMessage, ElMessageBox } from "element-plus";
 const { proxy } = getCurrentInstance();
 const contractType = ref([]);
 const corporationList = ref([]);
-const customerList = ref([]);
 const status = ref([
   {
     label: "草稿",
@@ -140,19 +140,9 @@ const config = computed(() => {
     {
       attrs: {
         label: "客户",
-        prop: "buyCorporationId",
+        prop: "buyCorporationName",
         "min-width": 220,
       },
-      render(type) {
-        let text = "";
-        if (customerList.value && customerList.value.length > 0) {
-          let data = customerList.value.filter((item) => item.value == type);
-          if (data && data.length > 0) {
-            text = data[0].label;
-          }
-        }
-        return text;
-      },
     },
     {
       attrs: {
@@ -269,26 +259,19 @@ const getDict = () => {
       };
     });
   });
-  proxy.post("/customer/page", { pageNum: 1, pageSize: 999 }).then((res) => {
-    customerList.value = res.rows.map((item) => {
-      return {
-        ...item,
-        label: item.name,
-        value: item.id,
-      };
-    });
-  });
 };
 const getList = async (req) => {
   sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
   loading.value = true;
-  proxy.post("/contract/contractAndSamplePage", sourceList.value.pagination).then((res) => {
-    sourceList.value.data = res.rows;
-    sourceList.value.pagination.total = res.total;
-    setTimeout(() => {
-      loading.value = false;
-    }, 200);
-  });
+  proxy
+    .post("/contract/contractAndSamplePage", sourceList.value.pagination)
+    .then((res) => {
+      sourceList.value.data = res.rows;
+      sourceList.value.pagination.total = res.total;
+      setTimeout(() => {
+        loading.value = false;
+      }, 200);
+    });
 };
 getDict();
 getList();