erp-el-element/commontable/tabledialog/DeliveryDialog.vue

1406 lines
47 KiB
Vue
Raw Normal View History

2024-05-07 11:30:13 +08:00
<template>
<div>
<el-dialog
ref="Deliver"
title="发货"
:visible.sync="DeliverDialogVisible"
width="760px"
:before-close="close"
custom-class="Deliver-dialog"
>
<div class="Deliverinfo">
<div class="box-top">
<div class="flex-b">
<span>订单信息</span>
<span
>创建时间{{
DeliveryInfoList.create_time | dateformat("YYYY-MM-DD HH:mm:ss")
}}</span
>
</div>
<div class="flex-b goods">
<div class="img">
<el-popover placement="right" width="350" trigger="click">
<img
v-if="!!DeliveryInfoList['img']"
style="height: 350px"
:src="DeliveryInfoList['img']"
/>
<img
v-if="!!DeliveryInfoList['img']"
slot="reference"
style="height: 120px; width: 120px"
:src="DeliveryInfoList['img']"
/>
</el-popover>
</div>
<div class="title">
<div>
{{ DeliveryInfoList.brand_name }}{{ DeliveryInfoList.model_name
}}{{ DeliveryInfoList.rom_name
}}{{ DeliveryInfoList.color_name }}
</div>
<div>
售价:<span
>{{ (DeliveryInfoList.payment / 100).toFixed(2) }}</span
>
</div>
</div>
</div>
<el-checkbox v-model="Deliverychecked" @change="noDelivery"
>无需发货</el-checkbox
>
</div>
<div class="box-cneter" :style="{ height: boxHeight + 'px' }">
<div class="RUSinfo">
<div style="padding: 10px">
<div>
<span style="font-weight: bold; color: black">收件人信息</span>
<span style="margin-left: 10px" @click="copyinfo"
><el-link type="primary" :underline="false"
>一键复制收件人信息</el-link
><i
class="el-icon-document-copy"
style="color: rgb(102, 177, 255)"
/></span>
</div>
<div style="margin: 5px 0">
<div style="margin: 0px 0 5px 0">
<span style="color: black; font-size: 16px"
>收件人{{ DeliveryInfoList.consignee_name }}</span
>
<span style="color: black; margin-left: 40px; font-size: 16px"
>手机号{{ DeliveryInfoList.consignee_phone }}</span
>
</div>
<div>
<span style="color: black"
>收货地址{{ DeliveryInfoList.consignee_address }}</span
>
</div>
</div>
</div>
<div class="recipientsRemark">
<span style="font-weight: bold; color: black">备注信息</span>
<p>{{ DeliveryInfoList.remark }}</p>
</div>
</div>
<div class="addresschange">
<el-popover v-model="RUSvisible" placement="bottom-start">
<el-form
ref="RUSform"
:label-position="labelPosition"
label-width="80px"
:model="RUSform"
:rules="RUSrules"
>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="收件人" prop="consignee_name">
<el-input v-model="RUSform.consignee_name" size="small" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="手机号" prop="consignee_phone">
<el-input
v-model="RUSform.consignee_phone"
size="small"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="收货地址" prop="consignee_address">
<el-input
v-model="RUSform.consignee_address"
size="small"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="btnbox">
<el-button
type="text"
class="btn"
@click="RUS_Confirm('RUSform')"
>确定</el-button
>
<el-button type="text" class="btn" @click="cancel"
>取消修改<i
class="el-icon-circle-close"
style="margin-left: 5px"
/></el-button>
</div>
<el-button slot="reference" size="small"
>更改收件人信息<i
class="el-icon-circle-plus-outline"
style="margin-left: 5px"
/></el-button>
</el-popover>
</div>
<div style="padding: 10px">
<div>
<span style="font-weight: bold; color: black">寄件人信息</span>
</div>
<div style="margin: 5px 0">
<div style="margin: 0 0 5px 0">
<span style="color: black; font-size: 16px"
>寄件人{{ SHIPPER[0].shipper_name }}</span
>
<span style="color: black; margin-left: 40px; font-size: 16px"
>手机号{{ SHIPPER[0].mobile }}</span
>
</div>
<div>
<span style="color: black"
>寄件地址{{ SHIPPER[0].address }}</span
>
</div>
</div>
</div>
<div class="addresschange">
<el-popover v-model="SHIPPERvisible" placement="bottom-start">
<el-form
ref="SHIPPERform"
:label-position="labelPosition"
label-width="80px"
:model="SHIPPERform"
:rules="SHIPPERrules"
>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="物流名称" prop="logistics_name">
<el-select
v-model="SHIPPERform.logistics_name"
placeholder="请选择物流"
size="small"
@change="SHIPPER_AAE_change"
>
<el-option
v-for="item in SHIPPER_AAE"
: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="sender_name">
<el-select
size="small"
v-model="SHIPPERform.sender_name"
placeholder="请选择寄件人"
@change="senderChange"
>
<el-option
v-for="item in senderInfo"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="btnbox">
<el-button
type="text"
class="btn"
@click="SHIPPER_AAE_confirm('SHIPPERform')"
>确定</el-button
>
<el-button type="text" class="btn" @click="cancel"
>取消修改<i
class="el-icon-circle-close"
style="margin-left: 5px"
/></el-button>
</div>
<el-button slot="reference" size="small"
>更改寄件人信息<i
class="el-icon-circle-plus-outline"
style="margin-left: 5px"
/></el-button>
</el-popover>
</div>
<div style="padding: 20px 0 10px" class="DeliverForm">
<el-form
ref="Logisticsform"
:inline="true"
:model="Logisticsform"
:rules="Logisticsrules"
size="mini"
>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item
label="物流公司"
prop="company"
label-width="80px"
>
<el-select
v-model="Logisticsform.company"
placeholder="请选择物流公司"
clearable
@change="change_TPL = true"
>
<el-option
v-for="item in DeliverForm.translateoptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="快递单号"
prop="trac_num"
label-width="80px"
>
<el-input
v-model="Logisticsform.trac_num"
clearable
placeholder="请输入快递单号"
/>
</el-form-item>
<el-form-item>
<el-tooltip v-if="change_TPL" placement="top">
<div slot="content">
顺丰(京东)快递已支持快速<br />下单确认后将自动发货
</div>
<el-link
type="primary"
:underline="false"
@click="quickorder('downlist')"
>快速下单</el-link
>
</el-tooltip>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="发货备注" label-width="80px">
<el-input
v-model="Logisticsform.remark"
clearable
placeholder="请输入备注"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="密封袋" label-width="80px">
<el-input
v-model="Logisticsform.sealed_bag_code"
clearable
placeholder="请输入密封袋"
/>
</el-form-item>
<el-form-item>
<el-link
type="success"
:underline="false"
@click="quickorder('print')"
>打印面单</el-link
>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="DeliveryCancel"> </el-button>
<el-button type="primary" @click="DeliveryConfirm()"> </el-button>
</div>
</el-dialog>
<!-- 回填 -->
<Retreat
ref="Retreat"
:dialog.sync="retreatVisible"
:obj="retreatObj"
:form="retreatform"
:accesscatelist.sync="accesscatelist"
:row-details="rowDetails"
:input-list="InputList"
:input="retreatInput"
:res_advanced_search="res_advanced_search_data"
@returnGoods="returnGoods"
/>
<!-- 销售 -->
<SaleDialog
ref="Dialog"
:dialog-visible.sync="saleDialogVisible"
:p_user_id="$store.getters.p_user_id"
:loading="saleloading"
:accesscatelist.sync="accesscatelist"
:row-details="rowDetails"
:rule-form="saleRuleForm"
:obj="saleObj"
:input="Input"
:list="loadinglist"
@radio_change="radio_change"
@hide="hide"
@save="save"
/>
</div>
</template>
<script>
import { mapGetters } from "vuex";
import { Throttle } from "@/utils/public.js";
import { logistics_address_list } from "@/api/user";
import { sf_create_order } from "@/api/console";
import { jd_create_order } from "@/api/xy";
import { order_delivery_idle } from "@/api/idleFish";
import { update_price, goal_warehouse, new_sales_add } from "@/api/Jiqidetails";
export default {
props: [
"DeliverDialogVisible",
"copydetailsvalue",
"DeliverForm",
"SHIPPER",
"SHIPPER_AAE",
"DeliveryInfoList",
],
components: {
Retreat: () => import("@/components/Retreat"), //回填价格
SaleDialog: () => import("@/views/idleFish/saleDialog"), //销售
},
data() {
return {
Deliverychecked: false,
RUSvisible: false, //收件人信息修改
SHIPPERvisible: false, //寄件人修改
labelPosition: "right",
RUSform: {
consignee_name: "",
consignee_phone: "",
consignee_address: "",
},
SHIPPERform: {
logistics_name: "",
sender_name: "",
},
Logisticsform: {
company: "",
trac_num: "",
remark: "",
sealed_bag_code: "",
},
Logisticsrules: {
trac_num: [
{ required: true, message: "请输入快递单号", trigger: "change" },
],
company: [
{ required: true, message: "请选择物流公司", trigger: "blur" },
],
},
senderInfo: [], //寄件人信息
SHIPPERrules: {
logistics_name: [
{ required: true, message: "请选择物流名称", trigger: "change" },
],
sender_name: [
{ required: true, message: "寄件人不能为空", trigger: "blur" },
],
},
RUSrules: {
consignee_name: [
{ required: true, message: "收件人不能为空", trigger: "blur" },
],
consignee_phone: [
{ required: true, message: "手机号不能为空", trigger: "blur" },
],
consignee_address: [
{ required: true, message: "收货地址不能为空", trigger: "blur" },
],
},
boxHeight: 410, // 初始高度
change_TPL: false,
shipper_name: "",
//回填模态框》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》
retreatVisible: false, //回填价格
retreatObj: {
DialogTitle: "回填价格",
Button: "确认",
}, //回填价格
res_advanced_search_data: [],
retreatform: {},
rowDetails: {},
InputList: [
{
label: "回填价格",
type: "el-input",
span: 8,
show: true,
enName: "pay_amount",
placeholder: "请输入回填价格",
width: "width:100%",
prop: "pay_amount",
required: true,
},
{
label: "收款状态",
type: "el-select",
show: true,
span: 8,
enName: "pay_status",
placeholder: "请选择收款状态",
width: "width:100%",
prop: "pay_status",
required: true,
options: [
{ label: "未结算", value: 0 },
{ label: "已结算", value: 1 },
],
},
{
label: "业务员",
type: "el-select",
span: 8,
show: true,
enName: "salesman_id",
placeholder: "请选择业务员",
width: "width:100%",
prop: "pay_amount",
required: false,
options: [],
},
{
label: "自定义实际时间",
enName: "clearing_time",
span: 8,
show: true,
prop: "clearing_time",
required: false,
TimeType: "date",
valueformat: "timestamp",
width: "width:100%",
Typeshow: true,
type: "el-date-picker",
placeholder: "请选择自定义实际时间",
size: "mini",
filterable: true,
pickerOptions: {
disabledDate(time) {
return time.getTime() > Date.now();
},
shortcuts: [
{
text: "今天",
onClick(picker) {
picker.$emit("pick", new Date());
},
},
{
text: "昨天",
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24);
picker.$emit("pick", date);
},
},
],
},
},
{
label: "第三方销售订单号",
type: "el-input",
show: true,
span: 8,
enName: "three_sale_order_id",
placeholder: "请输入第三方销售订单号",
width: "width:100%",
prop: "three_sale_order_id",
required: false,
},
{
label: "备注",
type: "el-input",
show: true,
span: 8,
enName: "remark",
placeholder: "请输入备注",
width: "width:100%",
prop: "remark",
required: false,
},
],
retreatInput: [],
accesscatelist: [], //回填价格
//销售模态框》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》》
saleDialogVisible: false, //销售
saleloading: false, //销售
Input: [],
loadinglist: [],
saleRuleForm: {
accessories: [{ customer_id: "", pay_amount: "", accessories: "" }],
repair: "",
is_sales_accessories: 0, // 是否配件销售 默认:否
sales_type: 1, //销售类型
},
saleObj: { Button: "确定", DialogTitle: "添加销售" }, //销售
rowDetails: {},
accesscatelist: [], //回填价格
account_class_code: "",
mobile: "",
address: "",
};
},
watch: {
DeliveryInfoList: {
handler(val) {
console.log(val, "valavaf");
if (!val) return;
this.boxHeight = 410;
this.RUSform = {
consignee_name: val.consignee_name,
consignee_phone: val.consignee_phone,
consignee_address: val.consignee_address,
};
},
deep: true,
immediate: true,
},
},
computed: {
...mapGetters(["is_phone_move"]),
},
methods: {
// 最终发货确认
DeliveryConfirm() {
let isno_delivery_checked = "";
this.Deliverychecked
? (isno_delivery_checked = 1)
: (isno_delivery_checked = 0);
this.$refs["Logisticsform"].validate((valid) => {
if (!valid) return;
const obj = this.SHIPPER.find(
(item) => item.express_company_id === this.Logisticsform.company
);
let params = {};
if (obj == undefined) {
params = {
xy_order_id: this.DeliveryInfoList.id,
express_no: this.Logisticsform.trac_num,
no_delivery_required: isno_delivery_checked,
};
} else {
params = {
xy_order_id: this.DeliveryInfoList.id,
express_no: this.Logisticsform.trac_num,
express_name: obj.express_company_name,
express_company_id: obj.express_company_id,
send_address: obj.address,
send_name: obj.shipper_name,
send_phone: obj.mobile,
};
}
order_delivery_idle(params).then((res) => {
if (res.errcode === 0) {
if (this.DeliveryInfoList.sales_id > 0) {
this.priceBack(this.DeliveryInfoList); //触发回填价格
} else {
this.sale(this.DeliveryInfoList);
}
this.$emit("DeliveryConfirm");
}
});
});
},
// 取消发货
DeliveryCancel() {
this.cancel();
this.close();
},
//快速下单
quickorder(str) {
if (str === "downlist") {
const obj = {
sku_name:
this.DeliveryInfoList.brand_name +
" " +
this.DeliveryInfoList.model_name +
" " +
this.DeliveryInfoList.rom_name +
" " +
this.DeliveryInfoList.color_name,
addressee_name: this.DeliveryInfoList.consignee_name,
addressee_tel: this.DeliveryInfoList.consignee_phone,
addressee_address: this.DeliveryInfoList.consignee_address,
shipper_name: this.SHIPPER[0].shipper_name,
mobile: this.SHIPPER[0].mobile,
address: this.SHIPPER[0].address,
chx_product_id: this.DeliveryInfoList.chx_product_id,
imei: this.DeliveryInfoList.imei1
? this.DeliveryInfoList.imei1
: this.DeliveryInfoList.imei2,
};
if (this.Logisticsform.company === 2) {
sf_create_order(obj).then((res) => {
this.$set(
this.Logisticsform,
"trac_num",
res.datas.tracking_number
);
});
} else if (this.Logisticsform.company === 1) {
jd_create_order(obj).then((res) => {
if (res.errcode === 0) {
this.$message({ type: "success", message: "京东发货下单成功" });
this.$set(this.Logisticsform, "trac_num", res.datas.waybillCode);
}
});
}
} else {
const params = {
tracking_number: this.Logisticsform.trac_num,
// 2顺丰 1是京东
type: this.Logisticsform.company,
};
if (this.Logisticsform.company === 2) {
params.type = 1;
} else if (this.Logisticsform.company === 1) {
params.type = 2;
}
this.$emit("print", params);
}
},
RUS_Confirm(form) {
this.$refs[form].validate((valid) => {
if (!valid) return;
this.$emit("RUS_Confirm", this.RUSform);
});
},
SHIPPER_AAE_confirm(form) {
this.$refs[form].validate((valid) => {
if (!valid) return;
this.SHIPPER[0].shipper_name = this.shipper_name;
this.SHIPPER[0].mobile = this.mobile;
this.SHIPPER[0].address = this.address;
this.cancel(); //寄件人不修改接口数据,没必要在父组件返回
// this.$emit("SHIPPER_AAE_confirm", this.SHIPPERform);
});
},
cancel() {
this.RUSvisible = false;
this.SHIPPERvisible = false;
this.$refs.RUSform.resetFields(); // 清空修改收货人表单信息
this.$refs.SHIPPERform.resetFields(); // 清空修改收货人表单信息
},
close() {
this.$refs.Logisticsform.resetFields();
this.Deliverychecked = false;
this.Logisticsform = {
company: "",
trac_num: "",
remark: "",
sealed_bag_code: "",
};
this.$emit("CloseDeliverDialog");
},
noDelivery(e) {
this.Logisticsrules.trac_num[0].required = !e;
this.Logisticsrules.company[0].required = !e;
this.boxHeight = this.Deliverychecked ? 0 : 410;
},
copyinfo(e) {
const text =
"收件人:" +
this.DeliveryInfoList["consignee_name"] +
" 手机号:" +
this.DeliveryInfoList["consignee_phone"] +
" 收货地址:" +
this.DeliveryInfoList["consignee_address"];
this.copytext(e, text);
},
//获取寄件人
SHIPPER_AAE_change(e) {
logistics_address_list({ logistics_company_id: e }).then((res) => {
this.senderInfo = res.datas.map((item) => {
return {
label: item.name,
value: item.id,
};
});
this.SenderList = res.datas; //寄件人列表
});
},
//选择寄件人change
senderChange(e) {
let findRes = this.SenderList.find((item) => item.id == e);
if (findRes) {
this.shipper_name = findRes.name || ""; // 如果 name 为 undefined则赋值为空字符串
this.mobile = findRes.mobile || "";
this.address = findRes.address || "";
} else {
// 处理未找到元素的情况,例如:
console.error("没有找到匹配的寄件人");
this.shipper_name = "";
this.mobile = "";
this.address = "";
}
},
returnGoods: Throttle(function (data, title) {
console.log(data, "returnGoodsdata-----------------", title);
if (data.text == "回填价格") {
// 收入
const h = this.$createElement;
const _this = this;
data.row.sales_id = this.DeliveryInfoList.sales_id;
data.row.customer_id = 23343;
const obj = JSON.parse(JSON.stringify(data.row));
this.$delete(obj, "pay_status");
if (data.row.sales_type == 4) {
// 以旧换新 预售
update_price(obj).then((res) => {
if (res.errcode == 0) {
this.$refs.Retreat.newcheck = false;
this.$refs.Retreat.newcheckchange(false);
if (!!res.datas.qc_code && res.datas.qc_code.length != 0) {
this.notify = this.$notify({
title: " 提示",
message: h("div", [
h(
"span",
"该机器在第三方处于上架状态请前往待退回列表进行下架操作 "
),
h(
"a",
{
style: "color: #3498db",
on: {
click: _this.jup,
},
},
"立即前往"
),
]),
duration: 0,
});
}
}
loadingInstance.close();
this.$refs.Retreat.$refs.form.resetFields();
});
} else {
if (
Number(this.DeliveryInfoList.total_cost) >
Number(data.row.pay_amount)
) {
this.$confirm("您确定您的手机要亏本卖吗?", "提醒", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
const loadingInstance = this.$Loading.service({
text: "回填中...",
lock: true,
target: document.querySelector(".left"),
});
update_price(obj).then((res) => {
if (res.errcode == 0) {
// this.settlefuntion(data, res, 1)
if (!!res.datas.qc_code && res.datas.qc_code.length != 0) {
this.notify = this.$notify({
title: " 提示",
message: h("div", [
h(
"span",
"该机器在第三方处于上架状态请前往待退回列表进行下架操作 "
),
h(
"a",
{
style: "color: #3498db",
on: {
click: _this.jup,
},
},
"立即前往"
),
]),
duration: 0,
});
}
}
this.$refs.Retreat.$refs.form.resetFields();
loadingInstance.close();
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消",
});
});
} else {
const loadingInstance = this.$Loading.service({
text: "回填中...",
lock: true,
target: document.querySelector(".left"),
});
update_price(obj).then((res) => {
if (res.errcode == 0) {
// this.settlefuntion(data, res, 1)
if (!!res.datas.qc_code && res.datas.qc_code.length != 0) {
this.notify = this.$notify({
title: " 提示",
message: h("div", [
h(
"span",
"该机器在第三方处于上架状态请前往待退回列表进行下架操作 "
),
h(
"a",
{
style: "color: #3498db",
on: {
click: _this.jup,
},
},
"立即前往"
),
]),
duration: 0,
});
}
}
loadingInstance.close();
this.$refs.Retreat.$refs.form.resetFields();
});
}
}
}
}, 2000),
// 销售信息单选框
radio_change(val) {
this.$refs.Dialog.clearcheck();
this.copydetailsvalue.sales.map((res, index) => {
if (res.label == "销售类型") {
// 配件只能进行销售
this.$set(this.saleRuleForm, "sales_type", "");
res.options =
val == 0
? [
{ label: "上架", value: 2 },
{ label: "销售", value: 1 },
{ label: "铺货", value: 3 },
]
: [{ label: "销售", value: 1 }];
} else if (res.label == "IMEI是否出库") {
res.Typeshow = val != 0;
} else if (res.label == "配件名称") {
res.Typeshow = val != 0;
}
});
if (val == 0) {
this.$set(
this.saleRuleForm,
"tracking_num",
this.Logisticsform.trac_num
);
}
},
// 销售模态框内表单的显示隐藏
hide(data) {
console.log(data, this.saleRuleForm);
if (data.enName == "customer_id" || data.enName == "sales_type") {
this.account_class_code = data.account_class_code;
if (
this.account_class_code == "zlj" ||
this.account_class_code == "xy-yj"
) {
// this.$set(this.detailsdata.add_res[0], 'zljshow', true)
if (this.saleRuleForm.sales_type == 1) {
this.getcode("1", data);
} else if (this.saleRuleForm.sales_type == 2) {
this.getcode("2", data);
} else if (this.saleRuleForm.sales_type == 3) {
this.getcode("3", data);
}
} else if (this.account_class_code == "tcb") {
this.copydetailsvalue.sales.map((res, i) => {
if (res.enName == "xy_amount") {
res.Typeshow = true;
this.$set(this.saleRuleForm, "xy_amount", "");
}
});
} else {
// this.$set(this.detailsdata.add_res[0], 'zljshow', false)
this.copydetailsvalue.sales.map((res, i) => {
if (res.enName == "xy_amount") {
res.Typeshow = false;
this.$set(this.saleRuleForm, "xy_amount", "");
}
});
}
}
if (data.enName == "customer_id" || data.enName == "sales_type") {
if (
this.account_class_code == "zlj" &&
this.saleRuleForm.sales_type == 3
) {
// 只有铺货有供货单号
this.copydetailsvalue.sales.map((res, i) => {
if (res.enName == "supplier_order_no") {
res.Typeshow = true;
}
});
} else {
this.copydetailsvalue.sales.map((res, i) => {
if (res.enName == "supplier_order_no") {
res.Typeshow = false;
}
});
}
}
// if (data.enName == 'pay_status' && data.e == 0) {
// this.saleObj.Button = '确认'
// } else if (data.enName == 'pay_status' && data.e == 1) {
// this.saleObj.Button = '确认并结算'
// }
if (data.enName == "pay_status") {
this.saleObj.Button = "确认";
}
if (data.enName == "sales_type" && data.e == 1) {
// 上架2 销售1 铺货3
this.copydetailsvalue.sales.map((res, i) => {
if (res.enName == "tracking_num" || res.enName == "pay_amount") {
res.Typeshow = true;
}
if (res.enName == "barcode") {
// 条形码
res.Typeshow = true;
if (
this.account_class_code == "zlj" ||
this.account_class_code == "xy-yj"
) {
// 转转销售
this.getcode("1", data);
}
}
if (res.enName == "pay_status") {
res.Typeshow = true;
this.$set(this.saleRuleForm, "pay_status", "");
}
if (res.enName == "warehouse_id") {
res.Typeshow = false;
}
// 机器是代卖的且总成本是0元显示采购回填价格
if (
this.rowDetails.instorage_type == 2 &&
res.enName == "purchase_price"
) {
res.Typeshow = true;
}
});
} else if (data.enName == "sales_type" && data.e == 2) {
this.copydetailsvalue.sales.map((res, i) => {
if (
res.enName == "tracking_num" ||
res.enName == "pay_amount" ||
res.enName == "pay_status" ||
res.enName == "purchase_price" ||
res.enName == "pay_channel" ||
res.enName == "pay_channel_id"
) {
res.Typeshow = false;
this.$set(this.saleRuleForm, "pay_amount", "");
this.$set(this.saleRuleForm, "tracking_num", "");
}
if (res.enName == "barcode") {
res.Typeshow = true;
if (
this.account_class_code == "zlj" ||
this.account_class_code == "xy-yj"
) {
// 转转上架
this.getcode("2", data);
}
}
if (this.is_phone_move == 1) {
if (res.enName == "warehouse_id") {
res.Typeshow = true;
const obj = {
is_me: 1,
};
goal_warehouse(obj).then((ress) => {
console.log(ress);
res.options = ress.datas.map((v) => {
return {
label: v.name,
value: v.warehouse_id,
};
});
});
}
}
});
} else if (data.enName == "sales_type" && data.e == 3) {
this.copydetailsvalue.sales.map((res, i) => {
if (res.enName == "tracking_num") {
res.Typeshow = true;
}
if (res.enName == "barcode") {
res.Typeshow = true;
if (
this.account_class_code == "zlj" ||
this.account_class_code == "xy-yj"
) {
// 转转铺货
this.getcode("3", data);
}
}
if (
res.enName == "pay_amount" ||
res.enName == "pay_status" ||
res.enName == "purchase_price" ||
res.enName == "pay_channel" ||
res.enName == "pay_channel_id" ||
res.enName == "outstorage_user_id"
) {
res.Typeshow = false;
this.$set(this.saleRuleForm, "tracking_num", "");
this.$set(this.saleRuleForm, "pay_amount", "");
}
if (res.enName == "warehouse_id") {
res.Typeshow = false;
}
});
}
},
getcode(type, data) {
// 刚进入页面加载
console.log(type, data);
if (type == "1") {
// 销售,(条码,价格,快递单号)
this.$set(this.loadinglist, "codeloading", 1); // 条形码
this.$set(this.loadinglist, "codeloading2", 1); // 快递单号
this.$set(this.loadinglist, "codeloading3", 1); // 销售价格
} else if (type == "2" || type == "3") {
// 上架,铺货(条码)
this.$set(this.loadinglist, "codeloading", 1); // 条形码
}
},
save: Throttle(function (data) {
console.log(data);
const that = this;
const clear = function (data) {
if (data.clear == 1) {
that.ruleForm = {
accessories: [{ customer_id: "", pay_amount: "", accessories: "" }],
repair: "",
is_sales_accessories: 0, // 是否配件销售 默认:否
};
}
};
data.row.new_other = {
in_or_out: data.row.in_or_out,
pay_class: data.row.pay_class,
amount: data.row.amount,
};
data.row.res_id = this.DeliveryInfoList.res_id;
const obj = JSON.parse(JSON.stringify(data.row));
this.$set(obj, "deliver_time", this.deliver_time);
// console.log(obj)
this.$delete(obj, "pay_status");
if (data.DialogTitle == "添加销售") {
if (data.row.is_sales_accessories == 0) {
if (data.newcheck == true) {
// 以旧换新 预售
const obj = JSON.parse(JSON.stringify(data.row));
this.$delete(obj, "pay_status");
this.$set(obj, "sales_type", 4);
new_sales_add(obj).then((res) => {
console.log("11111");
this.$refs.Dialog.newcheck = false;
this.$refs.Dialog.newcheckchange(false);
clear(data); // 清空
this.saleloading = false;
// this.saleErrcode(res.errcode);
if (res.errcode === 0) {
this.saleDialogVisible = false;
this.saleloading = false;
}
});
} else {
/* 机器销售 判断是否处于上架中 使用sales_type字段表明 字段取反 否则会提示undefined*/
if (
data.row.sales_type == 1 &&
Number(this.DeliveryInfoList.total_cost) >
Number(data.row.pay_amount)
) {
// 只有在销售时才判断是否亏本卖
this.$confirm("您确定您的手机要亏本卖吗?", "提醒", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.saleloading = true;
new_sales_add(obj)
.then((res) => {
console.log("22222");
// this.saleErrcode(res.errcode);
this.saleloading = false;
if (res.errcode == 0) {
this.saleDialogVisible = false;
// this.settlefuntion(data, res, 1)
}
if (res.errcode == 1006) {
console.log(6);
this.redialogVisible = true;
const obj = {
num: 1,
op_status1: res.datas[0].op_status, // 机器状态
qc_code: res.datas[0].qc_code, // 质检码
serial_number: res.datas[0].serial_number, // 编号
sales_reshelves_id: res.datas[0].sales_reshelves_id, // 传给后端的数据
imei:
this.DeliveryInfoList.imei1 ||
this.DeliveryInfoList.imei2 ||
this.DeliveryInfoList.sn, // 机器imei
op_status2: this.DeliveryInfoList.op_status, // 旧机器的机器状态
};
}
clear(data); // 清空
this.saleloading = false;
})
.catch((err) => {
this.saleloading = false;
});
})
.catch(() => {
this.$message({
type: "info",
message: "已取消",
});
});
} else {
this.saleloading = true;
new_sales_add(obj).then((res) => {
console.log("333333");
// this.saleErrcode(res.errcode);
if (res.errcode == 0) {
// this.settlefuntion(data, res, 1)
this.redialogVisible = false;
this.saleDialogVisible = false;
}
if (res.errcode == 1006) {
console.log(6);
const obj = {
num: 1,
op_status1: res.datas[0].op_status, // 机器状态
qc_code: res.datas[0].qc_code, // 质检码
serial_number: res.datas[0].serial_number, // 编号
sales_reshelves_id: res.datas[0].sales_reshelves_id, // 传给后端的数据
imei:
this.DeliveryInfoList.imei1 ||
this.DeliveryInfoList.imei2 ||
this.DeliveryInfoList.sn, // 机器imei
op_status2: this.DeliveryInfoList.op_status, // 旧机器的机器状态
};
}
clear(data); // 清空
this.saleloading = false;
});
}
}
} else {
this.saleloading = true;
new_sales_add(obj).then((res) => {
console.log("4444");
// this.saleErrcode(res.errcode);
if (res.errcode == 1006) {
console.log(6);
this.redialogVisible = true;
const obj = {
num: 1,
op_status1: res.datas[0].op_status, // 机器状态
qc_code: res.datas[0].qc_code, // 质检码
serial_number: res.datas[0].serial_number, // 编号
sales_reshelves_id: res.datas[0].sales_reshelves_id, // 传给后端的数据
imei:
this.DeliveryInfoList.imei1 ||
this.DeliveryInfoList.imei2 ||
this.DeliveryInfoList.sn, // 机器imei
op_status2: this.DeliveryInfoList.op_status, // 旧机器的机器状态
};
}
if (res.errcode === 0) {
this.saleDialogVisible = false;
this.saleloading = false;
}
clear(data); // 清空
this.saleloading = false;
});
}
}
}, 2000),
//销售
sale(row) {
// this.DeliveryInfoList = row;
console.log(
this.DeliveryInfoList,
"this.DeliveryInfoListthis.DeliveryInfoList"
);
this.saleDialogVisible = true;
this.Input = this.copydetailsvalue["sales"];
//总价格
this.$set(
this.rowDetails,
"total_cost",
this.DeliveryInfoList["total_cost"]
);
// 第三方订单号
this.$set(
this.saleRuleForm,
"three_sale_order_id",
this.DeliveryInfoList["biz_order_id"]
);
// 快递单号
this.$set(this.saleRuleForm, "tracking_num", this.Logisticsform.trac_num);
// 价格
this.$set(
this.saleRuleForm,
"pay_amount",
this.DeliveryInfoList["payment"] / 100
);
//送货方式
this.$set(this.saleRuleForm, "shipping_method", 1);
//imei||sn
this.$set(
this.rowDetails,
"imei1",
this.DeliveryInfoList["imei1"] ||
this.DeliveryInfoList["imei2"] ||
this.DeliveryInfoList["sn"]
);
},
//回填价格
priceBack(row) {
this.DeliveryInfoList = row;
this.retreatVisible = true;
this.backfill();
},
//回填价格
backfill() {
// this.rowDetails.xy_type = 1
//总价格
this.$set(
this.rowDetails,
"total_cost",
this.DeliveryInfoList["total_cost"]
);
// 客户
this.$set(this.retreatObj, "customer_name", "闲鱼严选");
// 添加时间
this.$set(
this.retreatObj,
"add_time",
this.DeliveryInfoList["create_time"]
);
// 价格
this.$set(
this.retreatform,
"pay_amount",
this.DeliveryInfoList["payment"] / 100
);
// 快递单号
this.$set(
this.retreatform,
"tracking_num",
this.DeliveryInfoList["express_no"]
);
// 第三方订单号
this.$set(
this.retreatform,
"three_sale_order_id",
this.DeliveryInfoList["biz_order_id"]
);
// 付款状态
this.$set(this.retreatform, "pay_status", "0");
// 选择出库
this.$set(this.retreatform, "is_outstorage", 1);
// 选择送货方式
this.$set(this.retreatform, "shipping_method", 1);
},
},
};
</script>
<style scoped lang='scss'>
::v-deep .Deliver-dialog {
.el-dialog__body {
padding: 0px !important;
}
}
.Deliverinfo {
padding: 0 20px;
box-sizing: border-box;
.box-top {
.flex-b {
padding: 10px;
box-sizing: border-box;
display: flex;
justify-content: space-between;
span {
font-weight: 600;
color: black;
font-size: 16px;
}
}
.goods {
.title {
width: 420px;
div {
padding: 10px;
color: black;
font-size: 16px;
span {
font-style: none;
color: red;
}
}
}
}
}
}
.box-cneter {
transition: height 0.5s ease;
overflow: hidden;
}
.RUSinfo {
display: flex;
.recipientsRemark {
width: 40%;
padding: 10px;
}
}
.btnbox {
display: flex;
justify-content: flex-end;
}
::v-deep .DeliverForm {
.el-input__inner {
width: 180px !important;
}
}
</style>