|
@@ -4,12 +4,13 @@
|
|
|
:model="ruleForm"
|
|
|
:rules="rules"
|
|
|
status-icon
|
|
|
+ :size="'small'"
|
|
|
ref="ruleForm"
|
|
|
label-width="85px"
|
|
|
class="demo-ruleForm"
|
|
|
>
|
|
|
<el-row>
|
|
|
- <el-col :span="id === 'add' ? 24 : 12">
|
|
|
+ <el-col :span="id === 'add' ? 12 : 12">
|
|
|
<el-form-item label="可入库总数" prop="wsend_num">
|
|
|
<el-input
|
|
|
disabled
|
|
@@ -19,17 +20,61 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="id === 'add' ? 24 : 12">
|
|
|
+ <el-col :span="id === 'add' ? 12 : 12">
|
|
|
<el-form-item label="入库数量" prop="send_num">
|
|
|
- <el-input
|
|
|
+ <digital-input
|
|
|
+ :values="ruleForm.send_num"
|
|
|
+ :placeholder="'入库数量'"
|
|
|
+ :min="0"
|
|
|
+ :name="'ruleForm.send_num'"
|
|
|
:disabled="id !== 'add'"
|
|
|
- placeholder="入库数量"
|
|
|
- v-model="ruleForm.send_num"
|
|
|
- maxlength="100"
|
|
|
+ :max="ruleForm.wsend_num"
|
|
|
+ :position="'right'"
|
|
|
+ :precision="0"
|
|
|
+ :size="'small'"
|
|
|
+ :controls="false"
|
|
|
+ :append="''"
|
|
|
+ @reschange="number_change($event, 'send_num')"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="id === 'add' ? 12 : 12">
|
|
|
+ <el-form-item label="发货方式" prop="sendtype">
|
|
|
+ <el-select
|
|
|
+ v-model="ruleForm.sendtype"
|
|
|
+ style="width: 100%"
|
|
|
+ :disabled="id !== 'add'"
|
|
|
+ placeholder="发货方式"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in options"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="id === 'add' ? 12 : 12">
|
|
|
+ <el-form-item label="物流费用" prop="post_fee">
|
|
|
+ <digital-input
|
|
|
+ :values="ruleForm.post_fee"
|
|
|
+ :placeholder="'物流费用'"
|
|
|
+ :min="0"
|
|
|
+ :name="'ruleForm.post_fee'"
|
|
|
+ :disabled="id !== 'add'"
|
|
|
+ :max="ruleForm.post_fee"
|
|
|
+ :position="'right'"
|
|
|
+ :precision="2"
|
|
|
+ :size="'small'"
|
|
|
+ :controls="false"
|
|
|
+ :append="'元'"
|
|
|
+ @reschange="number_change($event, 'post_fee')"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="id === 'add' ? 24 : 12">
|
|
|
+ <el-col :span="id === 'add' ? 24 : 12" v-show="ruleForm.sendtype === '1'">
|
|
|
<el-form-item label="物流公司" prop="post_company">
|
|
|
<search-express
|
|
|
:disabled="id !== 'add'"
|
|
@@ -41,7 +86,7 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="id === 'add' ? 24 : 12">
|
|
|
+ <el-col :span="id === 'add' ? 24 : 12" v-show="ruleForm.sendtype === '1'">
|
|
|
<el-form-item label="物流单号" prop="post_code">
|
|
|
<el-input
|
|
|
:disabled="id !== 'add'"
|
|
@@ -51,19 +96,8 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="id === 'add' ? 24 : 12">
|
|
|
- <el-form-item label="物流费用" prop="post_fee">
|
|
|
- <el-input
|
|
|
- :disabled="id !== 'add'"
|
|
|
- placeholder="物流费用"
|
|
|
- v-model="ruleForm.post_fee"
|
|
|
- maxlength="100"
|
|
|
- >
|
|
|
- <template slot="append">元</template>
|
|
|
- </el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="id === 'add' ? 24 : 12">
|
|
|
+
|
|
|
+ <el-col :span="id === 'add' ? 12 : 12">
|
|
|
<el-form-item label="发货时间" prop="post_time">
|
|
|
<el-date-picker
|
|
|
:disabled="id !== 'add'"
|
|
@@ -78,7 +112,7 @@
|
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="24" style="text-align: right" v-if="id === 'add'">
|
|
|
+ <el-col :span="12" style="text-align: right" v-if="id === 'add'">
|
|
|
<el-button type="primary" :size="'mini'" @click="submitForm"
|
|
|
>保 存
|
|
|
</el-button>
|
|
@@ -95,28 +129,29 @@ export default {
|
|
|
props: ["id", "sitem", "newTime", "modelSitem"],
|
|
|
mixins: [resToken],
|
|
|
data() {
|
|
|
- const validatePrice = (rule, value, callback) => {
|
|
|
- if (value === "") {
|
|
|
+ const validate_num = (rule, value, callback) => {
|
|
|
+ const { required } = rule;
|
|
|
+ if (required && value === "") {
|
|
|
callback(new Error("不能为空!"));
|
|
|
} else {
|
|
|
- if (isnumber(value)) {
|
|
|
- callback();
|
|
|
- } else if (isnumber2(value)) {
|
|
|
- callback();
|
|
|
- } else {
|
|
|
- callback(new Error("仅支持整数或两位小数!"));
|
|
|
- }
|
|
|
+ callback();
|
|
|
}
|
|
|
};
|
|
|
- const validateWeight = (rule, value, callback) => {
|
|
|
- if (value === "") {
|
|
|
- callback(new Error("不能为空!"));
|
|
|
+ const validate_num_0 = (rule, value, callback) => {
|
|
|
+ const { required } = rule;
|
|
|
+ if (required && value === "") {
|
|
|
+ callback(new Error("不能为空!"));
|
|
|
+ } else if (
|
|
|
+ required &&
|
|
|
+ (value === "0" ||
|
|
|
+ value === "0." ||
|
|
|
+ value === "0.0" ||
|
|
|
+ value === "0.00" ||
|
|
|
+ value === "0.000")
|
|
|
+ ) {
|
|
|
+ callback(new Error("不能为零!"));
|
|
|
} else {
|
|
|
- if (!isnumber(value)) {
|
|
|
- callback(new Error("仅支持整数!"));
|
|
|
- } else {
|
|
|
- callback();
|
|
|
- }
|
|
|
+ callback();
|
|
|
}
|
|
|
};
|
|
|
const validateCode = (rule, value, callback) => {
|
|
@@ -146,10 +181,25 @@ export default {
|
|
|
send_num: "",
|
|
|
status: "1",
|
|
|
},
|
|
|
+ options: [
|
|
|
+ {
|
|
|
+ value: "1",
|
|
|
+ label: "公司自提",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ value: "2",
|
|
|
+ label: "供应商包邮",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ pickerOptions: {
|
|
|
+ disabledDate: (time) => {
|
|
|
+ return time.getTime() > new Date().valueOf();
|
|
|
+ },
|
|
|
+ },
|
|
|
rules: {
|
|
|
send_num: {
|
|
|
required: true,
|
|
|
- validator: validateWeight,
|
|
|
+ validator: validate_num_0,
|
|
|
trigger: "blur",
|
|
|
},
|
|
|
post_company: {
|
|
@@ -158,6 +208,11 @@ export default {
|
|
|
trigger: "change",
|
|
|
message: "请输入物流公司",
|
|
|
},
|
|
|
+ sendtype: {
|
|
|
+ required: true,
|
|
|
+ trigger: "change",
|
|
|
+ message: "选择发货方式",
|
|
|
+ },
|
|
|
post_code: {
|
|
|
required: true,
|
|
|
validator: validateCode,
|
|
@@ -165,7 +220,7 @@ export default {
|
|
|
},
|
|
|
post_fee: {
|
|
|
required: true,
|
|
|
- validator: validatePrice,
|
|
|
+ validator: validate_num,
|
|
|
trigger: "blur",
|
|
|
},
|
|
|
post_time: {
|
|
@@ -209,6 +264,7 @@ export default {
|
|
|
wsm_code,
|
|
|
send_num,
|
|
|
wsend_num,
|
|
|
+ sendtype,
|
|
|
} = this.sitem;
|
|
|
this.ruleForm = {
|
|
|
// wsm_mobile,
|
|
@@ -221,37 +277,19 @@ export default {
|
|
|
post_code: post_code || "",
|
|
|
post_fee: post_fee || "",
|
|
|
post_time: sendtime || "",
|
|
|
+ sendtype: sendtype || "1",
|
|
|
send_num: send_num || "",
|
|
|
status: "1",
|
|
|
};
|
|
|
}
|
|
|
console.log(this.sitem);
|
|
|
-
|
|
|
- // const {
|
|
|
- // wsm_mobile,
|
|
|
- // wsm_contactor,
|
|
|
- // wsm_addr,
|
|
|
- // wsend_num,
|
|
|
- // cgdNo,
|
|
|
- // wsm_code,
|
|
|
- // } = this.modelSitem;
|
|
|
- // this.ruleForm = {
|
|
|
- // wsm_mobile,
|
|
|
- // wsm_contactor,
|
|
|
- // wsm_addr,
|
|
|
- // wsend_num,
|
|
|
- // cgdNo: cgdNo || "",
|
|
|
- // wsm_code: wsm_code || "",
|
|
|
- // post_company: [post_company] || [],
|
|
|
- // post_code: post_code || "",
|
|
|
- // post_fee: post_fee || "",
|
|
|
- // post_time: sendtime || "",
|
|
|
- // send_num: send_num || "",
|
|
|
- // status: "1",
|
|
|
- // };
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ number_change(e, key) {
|
|
|
+ this.ruleForm[key] = e + "" || "0";
|
|
|
+ this.$refs.ruleForm.validateField(key);
|
|
|
+ },
|
|
|
// 保存更改
|
|
|
async submitForm() {
|
|
|
await this.$refs.ruleForm.validate(async (valid) => {
|