|
@@ -3,624 +3,57 @@
|
|
|
ref="ruleForm"
|
|
|
:loading="loading"
|
|
|
:model="ruleForm"
|
|
|
- status-icon
|
|
|
- :rules="rulesThis"
|
|
|
label-width="100px"
|
|
|
style="width: 100%"
|
|
|
class="demo-ruleForm"
|
|
|
>
|
|
|
- <el-row>
|
|
|
- <el-row>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="异常数量" prop="anomalous_numbers">
|
|
|
- <el-input
|
|
|
- :disabled="disabled"
|
|
|
- v-model="ruleForm.anomalous_numbers"
|
|
|
- placeholder="请输入异常数量"
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="异常原因" prop="anomalous_reason">
|
|
|
- <el-select
|
|
|
- style="width: 100%"
|
|
|
- :disabled="disabled"
|
|
|
- v-model="ruleForm.anomalous_reason"
|
|
|
- placeholder="请选择异常原因"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in reason_options"
|
|
|
- :key="item.id"
|
|
|
- :label="item.result"
|
|
|
- :value="item.result_code"
|
|
|
- :disabled="item.status == 0"
|
|
|
- >
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="期望意愿" prop="expect_wish">
|
|
|
- <el-select
|
|
|
- style="width: 100%"
|
|
|
- :disabled="disabled"
|
|
|
- v-model="ruleForm.expect_wish"
|
|
|
- placeholder="请选择期望意愿"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in expect_options"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
- >
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="异常备注" prop="anomalous_remark">
|
|
|
- <el-input
|
|
|
- type="textarea"
|
|
|
- placeholder="请输入异常原因备注"
|
|
|
- v-model="ruleForm.anomalous_remark"
|
|
|
- :disabled="disabled"
|
|
|
- maxlength="250"
|
|
|
- show-word-limit
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
-
|
|
|
- <el-col :span="24">
|
|
|
- <el-form-item label="异常图片" prop="anomalous_images">
|
|
|
- <div class="el-form-item-error-img">
|
|
|
- <ul>
|
|
|
- <li
|
|
|
- class="images_li"
|
|
|
- :style="getMargin_li()"
|
|
|
- v-for="(item, index) in ruleForm.anomalous_images"
|
|
|
- :key="item"
|
|
|
- >
|
|
|
- <img :src="item" alt="" style="width: 254px; height: 164px" />
|
|
|
- <i class="el-icon-close" @click="imgClose(index)"></i>
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
- <div
|
|
|
- class="btnupload"
|
|
|
- :style="getMargin()"
|
|
|
- v-if="ruleForm.anomalous_images.length < 5 && isShow"
|
|
|
- style="position: relative"
|
|
|
- @click="open"
|
|
|
- >
|
|
|
- <i class="el-icon-plus avatar-uploader-icon"></i>
|
|
|
- <file-upload
|
|
|
- class="Upload"
|
|
|
- :accept="'.jpg,.png,.bmp,.jpeg'"
|
|
|
- :multiple="true"
|
|
|
- :uploadcondition="beforeAvatarUpload"
|
|
|
- @UploadErrorEvent="UploadErrorEvent"
|
|
|
- @UploadSuccessEvent="UploadSuccessEvent"
|
|
|
- />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <el-row v-if="ruleForm">
|
|
|
+ <el-col :span="12" v-for="item in columnsForm" :key="item.label">
|
|
|
+ <el-form-item :label="item.label">
|
|
|
+ <el-input
|
|
|
+ disabled
|
|
|
+ v-model="ruleForm[item.prop]"
|
|
|
+ :placeholder="item.label"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
-
|
|
|
- <el-col :span="24" style="text-align: right">
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- @click="submitForm"
|
|
|
- v-if="
|
|
|
- id === 'add' ||
|
|
|
- (status === '0' && powers.some((item) => item == '005'))
|
|
|
- "
|
|
|
- >保 存</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- @click="statusConfirm('1', '发起审核流程')"
|
|
|
- v-if="status === '0' && powers.some((item) => item == '012')"
|
|
|
- >发起审核流程
|
|
|
- </el-button>
|
|
|
- <el-button
|
|
|
- @click="statusConfirm('0', '取消审核流程')"
|
|
|
- plain
|
|
|
- v-if="status === '1' && powers.some((item) => item == '014')"
|
|
|
- >取消审核流程</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- @click="statusConfirm('-1', '作废该条信息')"
|
|
|
- type="danger"
|
|
|
- plain
|
|
|
- v-if="
|
|
|
- (status === '0' || status === '1') &&
|
|
|
- powers.some((item) => item == '015')
|
|
|
- "
|
|
|
- >作废该条信息</el-button
|
|
|
- >
|
|
|
- <el-button
|
|
|
- @click="statusConfirm('2', '通过审核')"
|
|
|
- type="primary"
|
|
|
- v-if="status === '1' && powers.some((item) => item == '016')"
|
|
|
- >通过审核</el-button
|
|
|
- >
|
|
|
- </el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import { isnumber } from "@/utils/validate.js";
|
|
|
-import asyncRequest from "@/apis/service/sellOut/sellAfterApply";
|
|
|
import resToken from "@/mixins/resToken";
|
|
|
+import columnsForm from "./columnsForm";
|
|
|
export default {
|
|
|
name: "handover",
|
|
|
- props: ["id", "sitem", "showModelThis", "newTime"],
|
|
|
+ props: ["id", "sitem", "newTime"],
|
|
|
mixins: [resToken],
|
|
|
data() {
|
|
|
- const validatenumbers = (rule, value, callback) => {
|
|
|
- if (value === "") {
|
|
|
- callback(new Error("异常数量不能为空!"));
|
|
|
- } else {
|
|
|
- if (!isnumber(value)) {
|
|
|
- callback(new Error("异常数量必须为数字"));
|
|
|
- } else {
|
|
|
- callback();
|
|
|
- }
|
|
|
- }
|
|
|
- };
|
|
|
return {
|
|
|
- isShow: true,
|
|
|
+ columnsForm: columnsForm,
|
|
|
loading: false,
|
|
|
- disabled: true,
|
|
|
- status: "", //存储详情接口返的状态
|
|
|
- showModelThis: this.showModel,
|
|
|
- resign_name: "", //离职人
|
|
|
- hand_name: "", //交接人
|
|
|
- ruleForm: {
|
|
|
- order_type: "1", //售后类型 1销售2咨询,
|
|
|
- outCode: "", //
|
|
|
- stock_out_numbers: "", //出库单编号
|
|
|
- anomalous_numbers: "", //异常数量
|
|
|
- anomalous_reason: "", //异常原因
|
|
|
- expect_wish: "", //期望意愿
|
|
|
- anomalous_images: [],
|
|
|
- anomalous_remark: "", //异常备注
|
|
|
- },
|
|
|
- rulesThis: this.rules,
|
|
|
- // 验证规则
|
|
|
- rules: {
|
|
|
- anomalous_numbers: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- trigger: "blur",
|
|
|
- validator: validatenumbers,
|
|
|
- },
|
|
|
- ],
|
|
|
- anomalous_reason: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: "请选择异常原因",
|
|
|
- trigger: "change",
|
|
|
- },
|
|
|
- ],
|
|
|
- expect_wish: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: "请选择期望意愿",
|
|
|
- trigger: "change",
|
|
|
- },
|
|
|
- ],
|
|
|
- anomalous_images: [
|
|
|
- {
|
|
|
- type: "array",
|
|
|
- required: true,
|
|
|
- message: "异常图片不能为空!",
|
|
|
- trigger: "change",
|
|
|
- },
|
|
|
- ],
|
|
|
- anomalous_remark: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: "请输入异常原因备注",
|
|
|
- trigger: "blur",
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- reason_options: [],
|
|
|
- reason_value: "", //异常原因
|
|
|
- expect_options: [
|
|
|
- {
|
|
|
- value: "1",
|
|
|
- label: "退货",
|
|
|
- },
|
|
|
- {
|
|
|
- value: "2",
|
|
|
- label: "换货",
|
|
|
- },
|
|
|
- {
|
|
|
- value: "3",
|
|
|
- label: "接受差异改变售价",
|
|
|
- },
|
|
|
- ],
|
|
|
- expect_value: "", //期望意愿
|
|
|
+ ruleForm: null,
|
|
|
code: "",
|
|
|
};
|
|
|
},
|
|
|
- computed: {
|
|
|
- powers() {
|
|
|
- let tran =
|
|
|
- this.$store.getters.btnList.find(
|
|
|
- (item) => item.menu_route == "handoverDetail"
|
|
|
- ) || {};
|
|
|
- if (tran && tran.action && tran.action.length > 0) {
|
|
|
- return tran.action;
|
|
|
- } else {
|
|
|
- return [];
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
- created() {
|
|
|
- this.getReason(); //获取异常原因
|
|
|
- this.initForm();
|
|
|
- },
|
|
|
watch: {
|
|
|
- id: function (val) {
|
|
|
- if (val) {
|
|
|
- this.initForm();
|
|
|
- }
|
|
|
- },
|
|
|
newTime: function (val) {
|
|
|
if (val) {
|
|
|
this.initForm();
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
+ mounted() {
|
|
|
+ this.initForm();
|
|
|
+ },
|
|
|
methods: {
|
|
|
- // 关闭弹窗,直接隐藏表单
|
|
|
- // async closeAddEdit() {
|
|
|
- // this.$emit("closeModel", false); //抛出一个事件,关闭弹窗
|
|
|
- //
|
|
|
- // },
|
|
|
- closeAdd() {
|
|
|
- this.showModelThis = false;
|
|
|
- },
|
|
|
async initForm() {
|
|
|
this.loading = true;
|
|
|
- console.log(this.id);
|
|
|
- console.log(this.sitem);
|
|
|
- if (this.id === "add") {
|
|
|
- this.status = "";
|
|
|
- this.rulesThis = this.rules;
|
|
|
- this.disabled = false;
|
|
|
- await this.resetForm();
|
|
|
- } else {
|
|
|
- this.isShow = false;
|
|
|
- this.rulesThis = this.rules;
|
|
|
- await this.resetForm();
|
|
|
- await this.initData();
|
|
|
- }
|
|
|
+ this.ruleForm = this.sitem;
|
|
|
this.loading = false;
|
|
|
},
|
|
|
- async initData() {
|
|
|
- console.log(this.sitem);
|
|
|
- if (this.sitem) {
|
|
|
- let { returnCode } = this.sitem;
|
|
|
- let model = {
|
|
|
- returnCode,
|
|
|
- };
|
|
|
- const res = await asyncRequest.detail(model);
|
|
|
- if (res && res.code === 0 && res.data) {
|
|
|
- let { error_num, error_img, error_remark, except_code, error_code } =
|
|
|
- res.data;
|
|
|
- console.log(res.data);
|
|
|
- this.ruleForm = {
|
|
|
- stock_out_numbers: "", //出库单编号
|
|
|
- anomalous_numbers: error_num, //异常数量
|
|
|
- anomalous_reason: error_code, //异常原因
|
|
|
- expect_wish: except_code, //期望意愿
|
|
|
- anomalous_images: [error_img],
|
|
|
- anomalous_remark: error_remark, //异常备注
|
|
|
- };
|
|
|
- } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout();
|
|
|
- } else {
|
|
|
- this.$message.warning(res.message);
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- async resetForm() {
|
|
|
- this.resign_name = "";
|
|
|
- this.hand_name = "";
|
|
|
- this.status = "";
|
|
|
- // 重置
|
|
|
- await this.$nextTick(() => {
|
|
|
- if (this.$refs.ruleForm) {
|
|
|
- this.$refs.ruleForm.resetFields();
|
|
|
- this.$refs.ruleForm.clearValidate();
|
|
|
- console.log(this.sitem);
|
|
|
- let { outCode } = this.sitem;
|
|
|
- this.code = outCode;
|
|
|
- // if (this.id === "add") {
|
|
|
- // let OutCode = "";
|
|
|
- // bum.map((ele) => {
|
|
|
- // OutCode = ele.outCode;
|
|
|
- // });
|
|
|
- this.ruleForm = {
|
|
|
- anomalous_numbers: "", //异常数量
|
|
|
- anomalous_reason: "", //异常原因
|
|
|
- expect_wish: "", //期望意愿
|
|
|
- anomalous_images: [],
|
|
|
- outCode: this.code,
|
|
|
- };
|
|
|
- // }
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- async submitForm() {
|
|
|
- await this.$refs.ruleForm.validate(async (valid) => {
|
|
|
- if (valid) {
|
|
|
- const { anomalous_numbers } = this.ruleForm;
|
|
|
- if (this.sitem.send_num < anomalous_numbers) {
|
|
|
- this.$message.warning("异常数量不能大于发货数量");
|
|
|
- return false;
|
|
|
- }
|
|
|
- let model = JSON.parse(JSON.stringify(this.ruleForm));
|
|
|
-
|
|
|
- // console.log("调接口");
|
|
|
- let _model = {
|
|
|
- order_type: "1",
|
|
|
- outCode: model.outCode,
|
|
|
- errorCode: model.anomalous_reason, //异常原因
|
|
|
- num: model.anomalous_numbers,
|
|
|
- remark: model.anomalous_remark,
|
|
|
- except_code: model.expect_wish,
|
|
|
- img: model.anomalous_images.toString(),
|
|
|
- };
|
|
|
-
|
|
|
- console.log(_model);
|
|
|
- const res = await asyncRequest.add(_model);
|
|
|
-
|
|
|
- if (res && res.code === 0) {
|
|
|
- const title = this.id === "add" ? "添加成功!" : "修改成功!";
|
|
|
- this.$notify.success({
|
|
|
- title,
|
|
|
- message: "",
|
|
|
- });
|
|
|
-
|
|
|
- if (this.id === "add") {
|
|
|
- this.showModelThis = false;
|
|
|
- this.$emit("refresh", false);
|
|
|
- } else {
|
|
|
- this.initForm();
|
|
|
- }
|
|
|
- } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout();
|
|
|
- } else {
|
|
|
- this.$message.warning(res.message);
|
|
|
- }
|
|
|
- } else {
|
|
|
- console.log("error submit!!");
|
|
|
- return false;
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- async statusConfirm(status, message) {
|
|
|
- await this.$confirm(`确定要${message}?`, {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning",
|
|
|
- })
|
|
|
- .then(async () => {
|
|
|
- if (status === "-1") {
|
|
|
- await this.deleteById(message);
|
|
|
- } else {
|
|
|
- await this.setStatus(status, message);
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- console.log("取消");
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- async deleteById(message) {
|
|
|
- const res = await asyncRequest.delete({ id: this.id });
|
|
|
- if (res && res.code === 0) {
|
|
|
- this.$notify.success({
|
|
|
- title: message + "成功!",
|
|
|
- message: "",
|
|
|
- });
|
|
|
-
|
|
|
- this.routeGoto("handover", {});
|
|
|
- } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout();
|
|
|
- } else {
|
|
|
- this.$message.warning(res.message);
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- async setStatus(status, message) {
|
|
|
- let model = {
|
|
|
- id: this.id,
|
|
|
- remark: "",
|
|
|
- status: status,
|
|
|
- };
|
|
|
- const res = await asyncRequest.status(model);
|
|
|
- this.loading = false;
|
|
|
- if (res && res.code === 0) {
|
|
|
- this.$notify.success({
|
|
|
- title: message + "成功!",
|
|
|
- message: "",
|
|
|
- });
|
|
|
- this.initForm();
|
|
|
- } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout();
|
|
|
- } else {
|
|
|
- this.$message.warning(res.message);
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- open() {
|
|
|
- this.show = true;
|
|
|
- },
|
|
|
- // 获取异常原因
|
|
|
- async getReason() {
|
|
|
- let model = {
|
|
|
- type: "2",
|
|
|
- page: 1,
|
|
|
- size: 100,
|
|
|
- };
|
|
|
- const res = await asyncRequest.reasonList(model);
|
|
|
- this.loading = false;
|
|
|
- if (res && res.code === 0) {
|
|
|
- this.reason_options = res.data.list;
|
|
|
- } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
- await this.logout();
|
|
|
- } else {
|
|
|
- this.$message.warning(res.message);
|
|
|
- }
|
|
|
- },
|
|
|
- // 异常原因
|
|
|
- handleAnomalousReason(e) {
|
|
|
- console.log(e);
|
|
|
- if (e) {
|
|
|
- this.ruleForm.anomalous_reason = e;
|
|
|
- } else {
|
|
|
- this.ruleForm.anomalous_reason = "";
|
|
|
- }
|
|
|
- this.$refs.ruleForm.validateField("company_img");
|
|
|
- },
|
|
|
- //图片上传失败
|
|
|
- UploadErrorEvent() {
|
|
|
- this.$message.error("图片上传失败!");
|
|
|
- this.$refs.ruleForm.validateField("anomalous_images");
|
|
|
- },
|
|
|
- //图片上传成功
|
|
|
- UploadSuccessEvent(data) {
|
|
|
- if (data && data.url && data.url !== "break") {
|
|
|
- const { url } = data.url;
|
|
|
- this.ruleForm.anomalous_images.push(url);
|
|
|
- this.$message.success("图片上传成功!");
|
|
|
- this.$refs.ruleForm.validateField("anomalous_images");
|
|
|
- }
|
|
|
- },
|
|
|
- //判断图片规格
|
|
|
- beforeAvatarUpload(file) {
|
|
|
- let isJPG = false,
|
|
|
- isLt2M = false;
|
|
|
- if (file) {
|
|
|
- if (
|
|
|
- file.type === "image/jpg" ||
|
|
|
- file.type === "image/png" ||
|
|
|
- file.type === "image/bmp" ||
|
|
|
- file.type === "image/jpeg"
|
|
|
- ) {
|
|
|
- isJPG = true;
|
|
|
- }
|
|
|
- isLt2M = file.size / 1024 / 1024 < 1;
|
|
|
- if (!isJPG) {
|
|
|
- this.$message.error("图片格式不正确!");
|
|
|
- }
|
|
|
- if (!isLt2M) {
|
|
|
- this.$message.error("图片大小不能超过 1MB!");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return isJPG && isLt2M;
|
|
|
- },
|
|
|
- imgClose(index) {
|
|
|
- this.ruleForm.anomalous_images.splice(index, 1);
|
|
|
- this.$refs.ruleForm.validateField("anomalous_images");
|
|
|
- },
|
|
|
- getMargin() {
|
|
|
- if (this.ruleForm.anomalous_images.length == 0) {
|
|
|
- return "margin:0;";
|
|
|
- } else if (this.ruleForm.anomalous_images.length < 3) {
|
|
|
- return "margin:0px 0 0 10px";
|
|
|
- } else {
|
|
|
- return "margin:10px 0 0 10px";
|
|
|
- }
|
|
|
- },
|
|
|
- getMargin_li() {
|
|
|
- if (this.ruleForm.anomalous_images.length <= 3) {
|
|
|
- return "margin:0 0 0 10px";
|
|
|
- } else {
|
|
|
- return "margin:10px 0 0 10px";
|
|
|
- }
|
|
|
- },
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-.el-form-item-error-img {
|
|
|
- width: 100%;
|
|
|
- ul {
|
|
|
- width: 100%;
|
|
|
- li {
|
|
|
- float: left;
|
|
|
- border: 1px solid rgb(220, 223, 230);
|
|
|
- // border-left: 0;
|
|
|
- box-sizing: border-box;
|
|
|
- width: 254px;
|
|
|
- height: 164px;
|
|
|
- line-height: 164px;
|
|
|
- position: relative;
|
|
|
- img {
|
|
|
- display: inline-block;
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- }
|
|
|
- .el-icon-close {
|
|
|
- position: absolute;
|
|
|
- top: 0;
|
|
|
- right: 0;
|
|
|
- z-index: 2;
|
|
|
- width: 25px;
|
|
|
- height: 25px;
|
|
|
- text-align: center;
|
|
|
- line-height: 25px;
|
|
|
- font-size: 19px;
|
|
|
- &:hover {
|
|
|
- color: #63cbe7;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-.images_li {
|
|
|
- // width: 254px;
|
|
|
- // height: 164px;
|
|
|
- float: left;
|
|
|
-}
|
|
|
-.btnupload {
|
|
|
- float: left;
|
|
|
- border: 1px solid rgb(220, 223, 230);
|
|
|
- // border-left: 0;
|
|
|
- box-sizing: border-box;
|
|
|
- width: 254px;
|
|
|
- height: 164px;
|
|
|
- line-height: 164px;
|
|
|
- text-align: center;
|
|
|
-}
|
|
|
-.Upload {
|
|
|
- width: 254px;
|
|
|
- height: 164px;
|
|
|
- line-height: 164px;
|
|
|
- text-align: center;
|
|
|
- position: absolute;
|
|
|
- line-height: 0px;
|
|
|
- top: 0;
|
|
|
- left: 0;
|
|
|
- z-index: 2;
|
|
|
- line-height: 164px;
|
|
|
-}
|
|
|
-.avatar-uploader-icon {
|
|
|
- font-size: 33px;
|
|
|
- color: #8c939d;
|
|
|
- width: 50px;
|
|
|
- height: 50px;
|
|
|
- line-height: 50px;
|
|
|
- text-align: center;
|
|
|
-}
|
|
|
</style>
|