yyb
9 天以前 463f6e76bc9f53f646d05f5afa7045e74a716c10
pages/wareHouse/nuclearScale/createwriteoffform.vue
@@ -2,34 +2,12 @@
  <!-- 核磅录入 -->
  <div class="page">
    <view class="packing-registration-bg" />
    <u-navbar
      title="核磅录入"
      :background="background"
      :border-bottom="false"
      :title-bold="true"
      title-color="#000"
      back-icon-color="#000"
    />
    <u-form
      :model="form"
      ref="uForm"
      :label-width="235"
      labelAlign="left"
      :rules="rules"
      :error-type="['toast']"
      class="uForm"
    >
      <u-form-item
        label="产品类型:"
        :border-bottom="false"
        prop="productType"
        style="font-size: small"
      >
        <u-radio-group
          v-model="form.productType"
          @change="handleProductTypeChange"
          style="font-size: small"
        >
      <u-navbar title="核磅录入" :background="background" :border-bottom="false" :title-bold="true" title-color="#000"
         back-icon-color="#000" />
      <u-form :model="form" ref="uForm" :label-width="235" labelAlign="left" :rules="rules" :error-type="['toast']"
         class="uForm">
         <u-form-item label="产品类型:" :border-bottom="false" prop="productType" style="font-size: small">
            <u-radio-group v-model="form.productType" @change="handleProductTypeChange" style="font-size: small">
          <u-radio name="DT01">导体</u-radio>
          <u-radio name="TG01">铜杆</u-radio>
          <u-radio name="DT02">导体2.6</u-radio>
@@ -46,219 +24,97 @@
          <u-radio name="0">否</u-radio>
        </u-radio-group>
      </u-form-item> -->
      <u-form-item
        label="车牌号:"
        :border-bottom="false"
        prop="licensePlate"
        style="font-size: small"
      >
        <u-input
          v-model="form.licensePlate"
          type="select"
          placeholder="请输入车牌号"
          @click="lpn"
        />
         <u-form-item label="车牌号:" :border-bottom="false" prop="licensePlate" style="font-size: small">
            <u-input v-model="form.licensePlate" type="select" placeholder="请输入车牌号" @click="lpn" />
      </u-form-item>
      <u-form-item
        label="客户名称1:"
        :border-bottom="false"
        prop="customerName1"
        style="font-size: small"
      >
        <picker
          class="item-one item-two"
          style="width: 100%; text-align: right"
          @change="selClientChange($event, selClientList, 'customerName1')"
          :value="selClientIndex1"
          :range="selClientList"
          range-key="label"
        >
         <u-form-item label="客户名称1:" :border-bottom="false" prop="customerName1" style="font-size: small">
            <picker class="item-one item-two" style="width: 100%; text-align: right"
               @change="selClientChange($event, selClientList, 'customerName1')" :value="selClientIndex1"
               :range="selClientList" range-key="label">
          <view>
            <text
              :style="{
                  <text :style="{
                color: selClientIndex1 == null ? '#a5abb4' : '#0c0c0c',
              }"
              >{{
              }">{{
                selClientIndex1 == null
                  ? "请选择"
                  : selClientList[selClientIndex1].label
              }}</text
            >
              }}</text>
          </view>
        </picker>
        <u-icon
          v-if="selClientIndex1 == null"
          name="arrow-right"
          color="#687792"
          size="28"
        ></u-icon>
            <u-icon v-if="selClientIndex1 == null" name="arrow-right" color="#687792" size="28"></u-icon>
      </u-form-item>
      <u-form-item
        label="发货通知单号1:"
        :border-bottom="false"
        prop="shippingNoticeNo1"
        style="font-size: small"
        :label-width="245"
      >
         <u-form-item label="发货通知单号1:" :border-bottom="false" prop="shippingNoticeNo1" style="font-size: small"
            :label-width="245">
        <u-input v-model="form.shippingNoticeNo1" placeholder="" disabled />
      </u-form-item>
      <u-form-item
        label="客户名称2:"
        :border-bottom="false"
        prop="customerName2"
        style="font-size: small"
      >
        <picker
          class="item-one item-two"
          style="width: 100%; text-align: right"
          @change="selClientChange($event, selClientList, 'customerName2')"
          :value="selClientIndex2"
          :range="selClientList"
          range-key="label"
        >
         <u-form-item label="客户名称2:" :border-bottom="false" prop="customerName2" style="font-size: small">
            <picker class="item-one item-two" style="width: 100%; text-align: right"
               @change="selClientChange($event, selClientList, 'customerName2')" :value="selClientIndex2"
               :range="selClientList" range-key="label">
          <view>
            <text
              :style="{
                  <text :style="{
                color: selClientIndex2 == null ? '#a5abb4' : '#0c0c0c',
              }"
              >{{
              }">{{
                selClientIndex2 == null
                  ? "请选择"
                  : selClientList[selClientIndex2].label
              }}</text
            >
              }}</text>
          </view>
        </picker>
        <u-icon
          v-if="selClientIndex2 == null"
          name="arrow-right"
          color="#687792"
          size="28"
        ></u-icon>
            <u-icon v-if="selClientIndex2 == null" name="arrow-right" color="#687792" size="28"></u-icon>
      </u-form-item>
      <u-form-item
        label="发货通知单号2:"
        :border-bottom="false"
        prop="shippingNoticeNo2"
        style="font-size: small"
        :label-width="245"
      >
         <u-form-item label="发货通知单号2:" :border-bottom="false" prop="shippingNoticeNo2" style="font-size: small"
            :label-width="245">
        <u-input v-model="form.shippingNoticeNo2" placeholder="" disabled />
      </u-form-item>
      <u-form-item
        label="生产车间:"
        :border-bottom="false"
        prop="workshop"
        style="font-size: small"
      >
        <picker
          class="item-one item-two"
          style="width: 100%; text-align: right"
          @change="workshopChange($event, workshopList)"
          :value="workshopIndex"
          :range="workshopList"
          range-key="label"
          :disabled="!form.productType"
        >
         <u-form-item label="生产车间:" :border-bottom="false" prop="workshop" style="font-size: small">
            <picker class="item-one item-two" style="width: 100%; text-align: right"
               @change="workshopChange($event, workshopList)" :value="workshopIndex" :range="workshopList"
               range-key="label" :disabled="!form.productType">
          <view>
            <text
              :style="{ color: workshopIndex == null ? '#a5abb4' : '#0c0c0c' }"
              >{{
                  <text :style="{ color: workshopIndex == null ? '#a5abb4' : '#0c0c0c' }">{{
                workshopIndex == null
                  ? "请选择"
                  : workshopList[workshopIndex].label
              }}</text
            >
              }}</text>
          </view>
        </picker>
        <u-icon
          v-if="workshopIndex == null"
          name="arrow-right"
          color="#687792"
          size="28"
        ></u-icon>
            <u-icon v-if="workshopIndex == null" name="arrow-right" color="#687792" size="28"></u-icon>
      </u-form-item>
      <u-form-item
        label="司磅员:"
        :border-bottom="false"
        prop="weighingOperator"
        style="font-size: small"
      >
        <picker
          class="item-one item-two"
          style="width: 100%; text-align: right"
          @change="weighmanChange($event, weighmanList)"
          :value="weighmanIndex"
          :range="weighmanList"
          range-key="label"
        >
         <u-form-item label="司磅员:" :border-bottom="false" prop="weighingOperator" style="font-size: small">
            <picker class="item-one item-two" style="width: 100%; text-align: right"
               @change="weighmanChange($event, weighmanList)" :value="weighmanIndex" :range="weighmanList"
               range-key="label">
          <view>
            <text
              :style="{ color: weighmanIndex == null ? '#a5abb4' : '#0c0c0c' }"
              >{{
                  <text :style="{ color: weighmanIndex == null ? '#a5abb4' : '#0c0c0c' }">{{
                weighmanIndex == null
                  ? "请选择"
                  : weighmanList[weighmanIndex].label
              }}</text
            >
              }}</text>
          </view>
        </picker>
        <u-icon
          v-if="weighmanIndex == null"
          name="arrow-right"
          color="#687792"
          size="28"
        ></u-icon>
            <u-icon v-if="weighmanIndex == null" name="arrow-right" color="#687792" size="28"></u-icon>
      </u-form-item>
      <u-form-item
        label="叉车工:"
        :border-bottom="false"
        prop="forkliftOperator"
        style="font-size: small"
      >
        <u-input
          v-model="form.forkliftOperator"
          type="select"
          placeholder="请选择"
          @click="openForkliftDriverList"
        />
         <u-form-item label="叉车工:" :border-bottom="false" prop="forkliftOperator" style="font-size: small">
            <u-input v-model="form.forkliftOperator" type="select" placeholder="请选择"
               @click="openForkliftDriverList" />
      </u-form-item>
    </u-form>
    <u-button type="primary" class="bottom-button1" @click="submit"
      >创建</u-button
    >
      <u-button type="primary" class="bottom-button1" @click="submit">创建</u-button>
    <!--车牌号 -->
    <modalBg ref="modalBg" :confirm="confirm">
      <u-field
        v-model="form.licensePlate"
        label="车牌号:"
        placeholder="请输入"
        :border-bottom="false"
      >
         <u-field v-model="form.licensePlate" label="车牌号:" placeholder="请输入" :border-bottom="false">
      </u-field>
    </modalBg>
    <!-- 叉车工 -->
    <u-modal
      v-model="showModal"
      title=""
      :show-cancel-button="true"
      :show-confirm-button="true"
      @confirm="confirmSelection"
      @cancel="cancel"
    >
      <u-modal v-model="showModal" title="" :show-cancel-button="true" :show-confirm-button="true"
         @confirm="confirmSelection" @cancel="cancel">
      <view class="popup-content" style="padding: 20rpx">
        <scroll-view
          scroll-y="true"
          style="height: 400rpx; transform: translateZ(0)"
        >
            <scroll-view scroll-y="true" style="height: 400rpx; transform: translateZ(0)">
          <view class="popup-header">
            <checkbox-group @change="checkboxChange">
              <label
                class="checkbox-item"
                v-for="(item, index) in checkboxList"
                :key="index"
              >
                     <label class="checkbox-item" v-for="(item, index) in checkboxList" :key="index">
                <checkbox :value="item.value" :checked="item.checked" />
                <text class="label">{{ item.label }}</text>
              </label>
@@ -301,13 +157,11 @@
        forkliftOperator: "",
      },
      rules: {
        productType: [
          {
               productType: [{
            required: true,
            message: "请选择产品类型",
            trigger: ["change"],
          },
        ],
               }, ],
        // replace: [
        //   {
        //     required: true,
@@ -315,35 +169,27 @@
        //     trigger: ["change", "blur"],
        //   },
        // ],
        licensePlate: [
          {
               licensePlate: [{
            required: true,
            message: "请输入车牌号",
            trigger: ["change", "blur"],
          },
        ],
        workshop: [
          {
               }, ],
               workshop: [{
            required: true,
            message: "请选择生产车间",
            trigger: ["change"],
          },
        ],
        weighingOperator: [
          {
               }, ],
               weighingOperator: [{
            required: true,
            message: "请选择司磅员",
            trigger: ["change"],
          },
        ],
        forkliftOperator: [
          {
               }, ],
               forkliftOperator: [{
            type: "string",
            required: true,
            message: "请至少选择一个叉车工",
            trigger: ["change"],
          },
        ],
               }, ],
      },
      // 客户名称
      selClientList: [],
@@ -582,7 +428,52 @@
        });
        return;
      }
            // 检查是否选择了客户名称相同的客户
            if (code === "customerName1" && this.selClientIndex2 !== null) {
               const otherCustomer = storage[this.selClientIndex2];
               if (selectedCustomer.label === otherCustomer.label) {
                  uni.showToast({
                     title: "不能选择客户名称相同的客户",
                     icon: "none",
                  });
                  return;
               }
            }
            if (code === "customerName2" && this.selClientIndex1 !== null) {
               const otherCustomer = storage[this.selClientIndex1];
               if (selectedCustomer.label === otherCustomer.label) {
                  uni.showToast({
                     title: "不能选择客户名称相同的客户",
                     icon: "none",
                  });
                  return;
               }
            }
            // 检查不同客户的收货地址、联系人、联系电话是否相同
            if (code === "customerName1" && this.selClientIndex2 !== null) {
               const otherCustomer = storage[this.selClientIndex2];
               if (selectedCustomer.receiverAddress !== otherCustomer.receiverAddress ||
                  selectedCustomer.contactPerson !== otherCustomer.contactPerson ||
                  selectedCustomer.contactPhone !== otherCustomer.contactPhone) {
                  uni.showToast({
                     title: "两个客户的收货地址、联系人或联系电话不相同,不能同时选择",
                     icon: "none",
                  });
                  return;
               }
            }
            if (code === "customerName2" && this.selClientIndex1 !== null) {
               const otherCustomer = storage[this.selClientIndex1];
               if (selectedCustomer.receiverAddress !== otherCustomer.receiverAddress ||
                  selectedCustomer.contactPerson !== otherCustomer.contactPerson ||
                  selectedCustomer.contactPhone !== otherCustomer.contactPhone) {
                  uni.showToast({
                     title: "两个客户的收货地址、联系人或联系电话不相同,不能同时选择",
                     icon: "none",
                  });
                  return;
               }
            }
      if (code === "customerName2") {
        this.selClientIndex2 = selectedIndex;
        this.form.customerName2 = selectedCustomer.label;
@@ -724,7 +615,10 @@
      // 客户名称验证 - 修改为至少有一个有值
      if (!this.form.customerName1 && !this.form.customerName2) {
        throw { type: "validation", message: "请至少选择一个客户名称" };
               throw {
                  type: "validation",
                  message: "请至少选择一个客户名称"
               };
      }
      return true;