1088 lines
41 KiB
Vue
1088 lines
41 KiB
Vue
<template>
|
||
<el-dialog
|
||
title="批量添加机器"
|
||
:visible.sync="batchshow"
|
||
width="1200px"
|
||
top="2vh"
|
||
append-to-body
|
||
class="dialogclass"
|
||
:close-on-click-modal="false"
|
||
:before-close="handleClose"
|
||
>
|
||
<div class="main" style="display:flex">
|
||
<div class="topclass">
|
||
<div>
|
||
<template>
|
||
<el-select class="top-select" v-model="imei_type" placeholder="请选择" size="small">
|
||
<el-option
|
||
v-for="item in [{label:'IMEI/IMEI2/SN',value:1},{label:'第三方条码',value:2},]"
|
||
:key="item.value"
|
||
:label="item.label"
|
||
:value="item.value"
|
||
/>
|
||
</el-select>
|
||
</template>
|
||
<el-input v-model="imei" type="textarea" :rows="8" :placeholder="imei_type ==1 ? '请输入IME/IME2/SN,换行表示:一行一台机器865928061032740 865928061032740 865928061032740':'请输入第三方条码 一行一台机器'" />
|
||
</div>
|
||
<div>
|
||
<span>备注</span>
|
||
<el-input v-model="remark" size="small" placeholder="请输入内容" clearable @input="editchange(remark,'remarkall')" />
|
||
<el-input v-model="remarkall" type="textarea" :rows="6" placeholder="请输入内容" style="margin-top:10px" @input="editchange(remarkall,'remark')" />
|
||
</div>
|
||
<div>
|
||
<div>机器等级(成色)</div>
|
||
<el-select v-model="grade" style="width:100%" size="small" placeholder="请选择机器等级(成色)" clearable @input="editchange(grade,'gradeall')">
|
||
<el-option
|
||
v-for="item in grade_options"
|
||
:key="item.value"
|
||
:label="item.label"
|
||
:value="item.value"
|
||
/>
|
||
</el-select>
|
||
<el-input v-model="gradeall" type="textarea" :rows="6" :placeholder="(grade_options && grade_options.length>0) ? '请输入机器等级(成色) 一行一台机器' : '暂无机器等级(成色)无法批量添加'" style="margin-top:10px" @input="editchange(gradeall,'grade')" />
|
||
</div>
|
||
</div>
|
||
<div style="margin-left: 20px;">
|
||
<div class="flex-b">
|
||
<div v-if="(formLabelAlign && formLabelAlign['warehousing_type'] == 1) || $route.name=='Createpurchaseorder'">
|
||
<span>价格</span>
|
||
<el-input v-model="price" size="small" placeholder="请输入价格" clearable @input=" price = AmountInput(price,2,'exceed');priceall=''" />
|
||
<el-input v-model="priceall" type="textarea" :rows="6" placeholder="请输入价格 一行一台机器" style="margin-top:10px" @input="priceall = ssaa(priceall,2);price=''" />
|
||
</div>
|
||
<div v-if="formLabelAlign && formLabelAlign['warehousing_type'] == 2">
|
||
<span>参考价</span>
|
||
<el-input v-model="reference_price" size="small" placeholder="请输入参考价" clearable @input=" reference_price = AmountInput(reference_price,2,'exceed');reference_priceall=''" />
|
||
<el-input v-model="reference_priceall" type="textarea" :rows="6" placeholder="请输入价格 一行一台机器" style="margin-top:10px" @input="reference_priceall = ssaa(reference_priceall,2);reference_price=''" />
|
||
</div>
|
||
<div style="margin-left:10px">
|
||
<div>账号锁/密码</div>
|
||
<el-select v-model="idlock" style="width:100%" size="small" placeholder="请选择ID锁" clearable @input="editchange(idlock,'idlockall')">
|
||
<el-option
|
||
v-for="item in id_options"
|
||
:key="item.value"
|
||
:label="item.label"
|
||
:value="item.value"
|
||
/>
|
||
</el-select>
|
||
<el-input v-model="idlockall" type="textarea" :rows="6" placeholder="请输入ID锁 一行一台机器(例如:有/无/未知)" style="margin-top:10px" @input="editchange(idlockall,'idlock')" />
|
||
</div>
|
||
</div>
|
||
<h3 style="font-weight: bold;">机器信息</h3>
|
||
<div>
|
||
<div style="display:flex;align-items:center;margin-bottom:10px">
|
||
<span class="label">机器数量:</span>
|
||
<el-input v-model="number" placeholder="请输入机器数量" style="width: 200px" size="small" />
|
||
<span style="color:red;margin-left:12px">最多支持入库2000台机器</span>
|
||
</div>
|
||
<el-row :gutter="10">
|
||
<el-col :span="8">
|
||
<span class="label">分类:</span>
|
||
<el-select v-model="form.cate_id" size="small" placeholder="请选择分类" filterable clearable @change="change(form.cate_id,'cate_id')">
|
||
<el-option v-for="(e,i) in cate_options" :key="i" :label="e.label" :value="e.value" />
|
||
</el-select>
|
||
</el-col>
|
||
<el-col :span="8">
|
||
<span class="label">品牌:</span>
|
||
<el-select v-model="form.brand_id" size="small" placeholder="请选择品牌" filterable clearable @change="change(form.brand_id,'brand_id')">
|
||
<el-option v-for="(e,i) in brand_options" :key="i" :label="e.label" :value="e.value" />
|
||
</el-select>
|
||
</el-col>
|
||
<el-col :span="8">
|
||
<span class="label">型号:</span>
|
||
<el-select v-model="form.model_id" size="small" placeholder="请选择型号" filterable clearable @change="change(form.model_id,'model_id')">
|
||
<el-option v-for="(e,i) in model_options" :key="i" :label="e.label" :value="e.value" />
|
||
</el-select>
|
||
</el-col>
|
||
</el-row>
|
||
<div v-if="!!form.model_id">
|
||
<div>
|
||
<h3 style="font-weight: bold;">容量</h3>
|
||
<div class="btnclass">
|
||
<el-button v-for="(v,index) in rom_options" :key="index" class="buttonDiv" plain :type="form.rom_id==v.value ? 'primary' :''" @click="romclick($event,v)">{{ v.label }}</el-button>
|
||
</div>
|
||
</div>
|
||
<h3 style="font-weight: bold;">颜色</h3>
|
||
<div style="display:flex;">
|
||
<div v-for="(v,index) in color_options" :key="index" style="display:flex;flex-direction:column;margin:0 5px;align-items: center;">
|
||
<el-popover
|
||
placement="right"
|
||
width="350"
|
||
trigger="click"
|
||
>
|
||
<el-image
|
||
v-if="v.img"
|
||
style="height: 350px"
|
||
:src="v.img"
|
||
>
|
||
<div slot="error" class="image-slot">
|
||
<i class="el-icon-picture-outline" />
|
||
</div>
|
||
</el-image>
|
||
<el-image
|
||
slot="reference"
|
||
style="height: 70px;width:70px"
|
||
:src="v.img"
|
||
>
|
||
<div slot="error" class="image-slot">
|
||
<i class="el-icon-picture-outline" />
|
||
</div>
|
||
</el-image>
|
||
</el-popover>
|
||
<div class="btnclass">
|
||
<el-button plain class="buttonDiv" :type="form.color_id==v.value ? 'primary' :''" @click="colorclick($event,v)">{{ v.label }}</el-button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!-- 属性 -->
|
||
<div style="margin:10px 0">
|
||
<h3 style="font-weight: bold;">属性</h3>
|
||
<el-form :inline="true">
|
||
<el-form-item label="客户" required>
|
||
<el-select v-model="form.customer_id" size="small" placeholder="请选择客户" filterable clearable>
|
||
<el-option v-for="(e,i) in customer_options" :key="i" :label="e.label" :value="e.value" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="质检员">
|
||
<el-select v-model="form.op_user_id" size="small" placeholder="请选择质检员" filterable clearable>
|
||
<el-option v-for="(e,i) in op_user_id_options" :key="i" :label="e.label" :value="e.value" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="报价师">
|
||
<el-select v-model="form.quote_user_id" size="small" placeholder="请选择报价师" filterable clearable>
|
||
<el-option v-for="(e,i) in quote_user_options" :key="i" :label="e.label" :value="e.value" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="国别">
|
||
<el-select v-model="form.countries" size="small" placeholder="请选择国别" filterable clearable>
|
||
<el-option v-for="(e,i) in countries_options" :key="i" :label="e.label" :value="e.value" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="网络制式">
|
||
<el-select v-model="form.network" size="small" placeholder="请选择网络制式" filterable clearable>
|
||
<el-option v-for="(e,i) in network_options" :key="i" :label="e.label" :value="e.value" />
|
||
</el-select>
|
||
</el-form-item>
|
||
<!-- <el-form-item label="机器成色" prop="fineness">
|
||
<el-input v-model="form.fineness" size="small" placeholder="请输入机器成色" clearable>
|
||
</el-input>
|
||
</el-form-item> -->
|
||
</el-form>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<span style="display: flex;justify-content: flex-end;align-items: center;margin-top: 50px;">
|
||
<span style="margin-right:5px">机器是否开启查询功能 </span>
|
||
<el-switch v-model="warranty_query" active-color="#3498db" :active-value="1" :inactive-value="2" @change="warrantychange" />
|
||
</span>
|
||
<span slot="footer" class="dialog-footer">
|
||
<el-button @click="handleClose()">取 消</el-button>
|
||
<el-button type="primary" :loading="btnLoading" @click="addphone">{{btnLoading?'数据加载中...':'确认'}} </el-button>
|
||
</span>
|
||
</el-dialog>
|
||
</template>
|
||
|
||
<script>
|
||
import { ai_model_update_v2, cate_brand_list_all, user_warranty_query } from '@/api/Warehousing' // 获取客户信息接口
|
||
import { res_advanced_search } from '@/api/machineList' // 获取机器列表信息接口
|
||
import { pre_print } from '@/api/machineList' // 获取列表信息接口
|
||
import { third_party_no, cate_brand_list, edit_drafts_box, purchase_order_edit_phone, batch_save_drafts_box } from '@/api/Warehousing' // 获取二维码信息接口
|
||
import { mapGetters } from 'vuex'
|
||
import { uuid } from 'vue-uuid'
|
||
import handle from 'ant-design-vue/lib/vc-slider/src/Handle'
|
||
export default {
|
||
name: 'EditBrand',
|
||
data() {
|
||
return {
|
||
imei_type: 1,
|
||
number: '',
|
||
quote_user_id: null,
|
||
customer_id: null,
|
||
countries: null,
|
||
network: null,
|
||
imei: '',
|
||
reference_price: '',
|
||
reference_priceall: '',
|
||
price: '',
|
||
priceall: '',
|
||
idlock: '',
|
||
idlockall: '',
|
||
remark: '',
|
||
remarkall: '',
|
||
grade: '',
|
||
gradeall: '',
|
||
keywords: '',
|
||
warranty_query: 2,
|
||
form: { customer_id: this.formLabelAlign.customer_id, cate_id: null, brand_id: null, model_id: null, rom_id: null, color_id: null,op_user_id:'' },
|
||
grade_options: [],
|
||
cate_options: [],
|
||
brand_options: [],
|
||
model_options: [],
|
||
rom_options: [],
|
||
color_options: [],
|
||
customer_options: [],
|
||
quote_user_options: [],
|
||
op_user_id_options: [],
|
||
network_options: [],
|
||
countries_options: [// 国别
|
||
{ label: '中国', value: '中国' },
|
||
{ label: '国行运营商', value: '国行运营商' },
|
||
{ label: '国行全网通', value: '国行全网通' },
|
||
{ label: '海外', value: '海外' },
|
||
{ label: '美版', value: '美版' },
|
||
{ label: '日本', value: '日本' },
|
||
{ label: '韩版', value: '韩版' },
|
||
{ label: '港澳台', value: '港澳台' },
|
||
{ label: '新加坡', value: '新加坡' },
|
||
{ label: '欧盟', value: '欧盟' },
|
||
{ label: '国际版', value: '国际版' }],
|
||
id_options: [
|
||
{ label: '有', value: 1 },
|
||
{ label: '无', value: 2 },
|
||
{ label: '未知', value: 0 }],
|
||
current: [],
|
||
brandtotal: null,
|
||
modeltotal: null,
|
||
romtotal: null,
|
||
default_brand_id: null,
|
||
default_model_id: null,
|
||
phone_list: [],
|
||
btnLoading:false,
|
||
}
|
||
},
|
||
computed: {
|
||
...mapGetters([
|
||
'is_warranty_query', // 1查询,2不查询
|
||
'user_id'
|
||
])
|
||
},
|
||
watch: {
|
||
formLabelAlign: {
|
||
handler() {
|
||
// console.log(now)
|
||
if (this.formLabelAlign.customer_id !== 0) {
|
||
this.form.customer_id = this.formLabelAlign.customer_id
|
||
}
|
||
if (this.formLabelAlign.op_user_id !== 0) {
|
||
this.form.op_user_id = this.formLabelAlign.op_user_id
|
||
}
|
||
},
|
||
deep: true
|
||
},
|
||
form: {
|
||
handler(now, old) {
|
||
// console.log(old)
|
||
this.$set(this.form, 'customer_id', old.customer_id)
|
||
// this.form.customer_id = old.customer_id
|
||
// console.log(now)
|
||
},
|
||
deep: true
|
||
},
|
||
'is_warranty_query': {
|
||
handler(val) {
|
||
this.warranty_query = val
|
||
}, deep: true, immediate: true
|
||
}
|
||
},
|
||
created() {
|
||
this.getcate()
|
||
},
|
||
mounted() {
|
||
|
||
},
|
||
props: {
|
||
batchshow: {
|
||
type: Boolean,
|
||
default: () => {
|
||
return false
|
||
}
|
||
},
|
||
is_batch: {
|
||
type: Boolean,
|
||
default: () => {
|
||
return false
|
||
}
|
||
},
|
||
tableData: {
|
||
type: Array,
|
||
default: () => {
|
||
return []
|
||
}
|
||
},
|
||
brandform: {
|
||
type: Object,
|
||
default: () => {
|
||
return {}
|
||
}
|
||
},
|
||
is_purchase: {
|
||
type: Number,
|
||
default: () => {
|
||
return ''
|
||
}
|
||
},
|
||
input: {
|
||
type: Array,
|
||
default: () => {
|
||
return []
|
||
}
|
||
},
|
||
formLabelAlign: {
|
||
type: Object,
|
||
default: () => {
|
||
return {}
|
||
}
|
||
},
|
||
jiqidata: {
|
||
type: Array,
|
||
default: () => {
|
||
return []
|
||
}
|
||
}
|
||
},
|
||
methods: {
|
||
ssaa(val, limit = 0, exceed) { // 金额输入框限制方法
|
||
if (this._.isNumber(val)) { // 判断是否数字类型
|
||
val = '' + val
|
||
}
|
||
// val = val.replace(/[^\d.]/g, ""); //保留数字
|
||
val = val.replace(/[^\r\n\d.]/g, '') // 保留数字换行
|
||
val = val.replace(/^00/, '0.') // 开头不能有两个0
|
||
val = val.replace(/^\./g, '0.') // 开头为小数点转换为0.
|
||
val = val.replace(/\.{2,}/g, '.') // 两个以上的小数点转换成一个
|
||
val = val.replace(/(\d\.[\d]{0,2}).*([\s]*)/g, '$1$2'); // 只保留一个小数点
|
||
/^0\d+/.test(val) ? val = val.slice(1) : '' // 两位以上数字开头不能为0
|
||
const str = '^(\\d+)\\.(\\d{' + limit + '}).*$'
|
||
const reg = new RegExp(str)
|
||
if (limit === 0) {
|
||
// 不需要小数点
|
||
val = val.replace(reg, '$1')
|
||
} else {
|
||
// 通过正则保留小数点后指定的位数
|
||
val = val.replace(reg, '$1.$2')
|
||
}
|
||
if (!!exceed && Number(val) > 30000) {
|
||
Message({ duration: 4000, message: '输入价格已超过30000', type: 'warning', showClose: true })
|
||
}
|
||
return val
|
||
},
|
||
inputchange(queryString, callback) {
|
||
if (!!queryString && queryString.length >= 2) {
|
||
// 调用的后台接口
|
||
cate_brand_list({ keywords: queryString }).then((res) => {
|
||
callback(res.datas)
|
||
}).catch((error) => {
|
||
})
|
||
} else {
|
||
callback([])
|
||
}
|
||
},
|
||
// 重置所有信息
|
||
resetinfo() {
|
||
const arr = ['imei', 'remark', 'remarkall', 'grade', 'gradeall', 'price', 'priceall', 'idlock', 'idlockall', 'number', 'reference_price', 'reference_priceall']
|
||
for (let index = 0; index < arr.length; index++) {
|
||
this.$set(this, arr[index], null)
|
||
}
|
||
},
|
||
// 是否查询状态改变
|
||
warrantychange(e) {
|
||
user_warranty_query({ user_id: this.user_id, is_warranty_query: e }).then(res => {
|
||
this.$message({ type: 'success', message: e == 1 ? '查询已开启' : '查询已关闭' })
|
||
this.$store.dispatch('user/getInfo')
|
||
})
|
||
},
|
||
// 添加机器
|
||
addphone() {
|
||
this.phone_list = []
|
||
let temp_resData = []; let temp_price = []; let temp_idlock = []; let temp_remark = []; let temp_grade = []; let temp_reference_price = []
|
||
// imei处理
|
||
if (this.imei) {
|
||
if (this.imei_type == 1) { // imei
|
||
this.imei = this.imei ? this.imei.trim().replace(/[\n]$/, '') : []
|
||
console.log(this.imei)
|
||
this.imei.split(/[(\r\n)\r\n]+/).map((res) => {
|
||
temp_resData.push(res.replace(/[\s]{2,}/gi, ' ').trim().split(/[\s]/))
|
||
})
|
||
console.log(temp_resData)
|
||
} else {
|
||
temp_resData = this.imei ? this.imei.trim().split('\n') : []
|
||
}
|
||
}
|
||
// 价格处理
|
||
if (this.priceall) {
|
||
temp_price = this.priceall ? this.priceall.trim().split('\n') : []
|
||
}
|
||
for (let index = 0; index < this._.max([temp_resData.length, temp_price.length, this.number]); index++) {
|
||
this.phone_list.push({ instorage_uuid: uuid.v4() })
|
||
}
|
||
// 参考价处理
|
||
if (this.reference_priceall) {
|
||
temp_reference_price = this.reference_priceall ? this.reference_priceall.trim().split('\n') : []
|
||
}
|
||
// IMEI赋值
|
||
if (temp_resData.length > 0) {
|
||
this.phone_list.map((e, i) => {
|
||
temp_resData.map((r, index) => {
|
||
if (i == index) {
|
||
if (this.imei_type == 1) {
|
||
this.phone_list[index].imei1 = r[0]
|
||
this.phone_list[index].imei2 = r[1]
|
||
this.phone_list[index].sn = r[2]
|
||
} else {
|
||
this.phone_list[index].product_no = r
|
||
}
|
||
}
|
||
})
|
||
})
|
||
}
|
||
// 价格赋值
|
||
if (temp_price.length > 0) {
|
||
this.phone_list.map((e, i) => {
|
||
temp_price.map((r, index) => {
|
||
if (i == index) {
|
||
this.phone_list[index].pay_amount = r
|
||
}
|
||
})
|
||
})
|
||
} else {
|
||
this.phone_list.map(e => {
|
||
e.pay_amount = this.price
|
||
})
|
||
}
|
||
// 参考价赋值
|
||
if (temp_reference_price.length > 0) {
|
||
this.phone_list.map((e, i) => {
|
||
temp_reference_price.map((r, index) => {
|
||
if (i == index) {
|
||
this.phone_list[index].reference_price = r
|
||
}
|
||
})
|
||
})
|
||
} else {
|
||
this.phone_list.map(e => {
|
||
e.reference_price = this.reference_price
|
||
})
|
||
}
|
||
// ID锁
|
||
if (this.idlockall) {
|
||
temp_idlock = this.idlockall ? this.idlockall.split('\n') : []
|
||
this.phone_list.map((e, i) => {
|
||
temp_idlock.map((r, index) => {
|
||
if (i == index) {
|
||
this.id_options.map((e) => {
|
||
if (r == e.label) {
|
||
r = e.value
|
||
}
|
||
this.phone_list[index].id_lock = r
|
||
})
|
||
}
|
||
})
|
||
})
|
||
} else {
|
||
this.phone_list.map(e => {
|
||
e.id_lock = this.idlock
|
||
})
|
||
}
|
||
// 机器等级
|
||
if (this.gradeall) {
|
||
temp_grade = this.gradeall ? this.gradeall.split('\n') : []
|
||
this.phone_list.map((e, i) => {
|
||
temp_grade.map((r, index) => {
|
||
if (i == index) {
|
||
this.grade_options.map((e) => {
|
||
if (r == e.label) {
|
||
r = e.value
|
||
}
|
||
this.phone_list[index].level_name = r
|
||
})
|
||
}
|
||
})
|
||
})
|
||
} else {
|
||
this.phone_list.map(e => {
|
||
e.level_name = this.grade
|
||
})
|
||
}
|
||
// 备注
|
||
if (this.remarkall) {
|
||
temp_remark = this.remarkall ? this.remarkall.split('\n') : []
|
||
this.phone_list.map((e, i) => {
|
||
temp_remark.map((r, index) => {
|
||
if (i == index) {
|
||
this.phone_list[index].remark = r
|
||
}
|
||
})
|
||
})
|
||
} else {
|
||
this.phone_list.map(e => {
|
||
e.remark = this.remark
|
||
})
|
||
}
|
||
this.btnLoading = true
|
||
if (this.formLabelAlign['warehousing_type'] == 1 ? (!!this.price || !!this.priceall) && !!this.form.customer_id : !!this.form.customer_id) {
|
||
if (temp_resData.length != 0) {
|
||
if (this.is_purchase == 2) {
|
||
batch_save_drafts_box({ is_warranty_query: this.is_warranty_query, imei_type: this.imei_type, phone_list: this.phone_list, client_type: 2, is_purchase: this.is_purchase, ...this.form }).then(res => {
|
||
this.btnLoading = false
|
||
if (res.errcode === 0) {
|
||
this.resetinfo()
|
||
this.form = {}
|
||
this.$parent.getlist()
|
||
this.handleClose()
|
||
}
|
||
})
|
||
} else {
|
||
third_party_no({ p_user_id: this.formLabelAlign.subsidiary, is_purchase: this.is_purchase, phone_list: this.phone_list }).then((res) => {
|
||
if (res.errcode == 0) {
|
||
if (this.is_purchase != 1) { // 入库
|
||
if (res.datas.length != 0) { // 拍机堂数据或者采购单数据
|
||
const len = res.datas.length
|
||
if (len >= 1) { // 不是采购单数据或存在采购单里只有1条
|
||
this.handleClose()
|
||
// 保存实物数据
|
||
this.$parent.pjtdata = []
|
||
res.datas.map(e => {
|
||
if (!e.pjt_info.every(s => { return !!s.res_id })) { // 未生成采购单的显示
|
||
e.pjt_info.map(k => {
|
||
// if (!k.res_id) {
|
||
this.$parent.pjtdata.push({ ...k, imei: e.imei, open: false, add: false, addshow: true })
|
||
// }
|
||
})
|
||
this.$parent.pjtshow = true
|
||
this.$parent.is_batch = true
|
||
}
|
||
})
|
||
if (this.$parent.is_batch == false) {
|
||
batch_save_drafts_box({ is_warranty_query: this.is_warranty_query, imei_type: this.imei_type, phone_list: this.phone_list, client_type: 2, is_purchase: this.is_purchase, ...this.form }).then(res => {
|
||
this.btnLoading = false
|
||
if (res.errcode === 0) {
|
||
if (!!res.datas.total_repeat_num && res.datas.total_repeat_num.length > 0) {
|
||
this.$parent.repeatshow = true
|
||
this.$parent.repeatdata = []
|
||
res.datas.total_repeat_num.map(e => {
|
||
e.repeat_num.map(k => {
|
||
this.$parent.repeatdata.push({ ...k, imei: e.imei, open: false, add: false, addshow: true })
|
||
})
|
||
})
|
||
this.$parent.is_batch = true
|
||
} else {
|
||
this.resetinfo()
|
||
this.form = {}
|
||
this.$parent.getlist()
|
||
}
|
||
this.handleClose()
|
||
}
|
||
})
|
||
}
|
||
}
|
||
} else {
|
||
batch_save_drafts_box({ is_warranty_query: this.is_warranty_query, imei_type: this.imei_type, phone_list: this.phone_list, client_type: 2, is_purchase: this.is_purchase, ...this.form }).then(res => {
|
||
this.btnLoading = false
|
||
if (res.errcode === 0) {
|
||
if (!!res.datas.total_repeat_num && res.datas.total_repeat_num.length > 0) {
|
||
this.$parent.repeatshow = true
|
||
this.$parent.repeatdata = []
|
||
res.datas.total_repeat_num.map(e => {
|
||
e.repeat_num.map(k => {
|
||
this.$parent.repeatdata.push({ ...k, imei: e.imei, open: false, add: false, addshow: true })
|
||
})
|
||
})
|
||
} else {
|
||
this.resetinfo()
|
||
this.$parent.getlist()
|
||
}
|
||
this.handleClose()
|
||
this.form = {}
|
||
}
|
||
})
|
||
}
|
||
} else { // 采购单
|
||
if (res.datas.length != 0) { // 拍机堂数据或者采购单数据
|
||
const len = res.datas.length
|
||
if (len >= 1) { // 不是采购单数据或存在采购单里只有1条
|
||
this.handleClose()
|
||
// 保存实物数据
|
||
this.$parent.pjttipdata = []
|
||
res.datas.map(e => {
|
||
this.phone_list.map(k => {
|
||
if (e.instorage_uuid == k.instorage_uuid) {
|
||
this._.remove(this.phone_list, k)
|
||
}
|
||
})
|
||
if (e.pjt_info.every(s => { return !!s.recycler_order_no })) { // 未生成采购单的显示
|
||
e.pjt_info.map(k => {
|
||
this.$parent.pjttipdata.push({ ...k, imei: e.imei, open: false, add: false, addshow: true })
|
||
})
|
||
this.$parent.pjttipshow = true
|
||
}
|
||
})
|
||
if (this.$parent.pjttipshow != true) {
|
||
batch_save_drafts_box({ is_warranty_query: this.is_warranty_query, imei_type: this.imei_type, phone_list: this.phone_list, client_type: 2, is_purchase: this.is_purchase, ...this.form }).then(res => {
|
||
this.btnLoading = false
|
||
if (res.errcode === 0) {
|
||
if (!!res.datas.total_repeat_num && res.datas.total_repeat_num.length > 0) {
|
||
this.$parent.repeatshow = true
|
||
this.$parent.repeatdata = []
|
||
res.datas.total_repeat_num.map(e => {
|
||
e.repeat_num.map(k => {
|
||
this.$parent.repeatdata.push({ ...k, imei: e.imei, open: false, add: false, addshow: true })
|
||
})
|
||
})
|
||
this.$parent.is_batch = true
|
||
} else {
|
||
this.resetinfo()
|
||
this.$parent.getlist()
|
||
}
|
||
this.handleClose()
|
||
}
|
||
// this.form={}
|
||
})
|
||
}
|
||
}
|
||
} else {
|
||
batch_save_drafts_box({ is_warranty_query: this.is_warranty_query, imei_type: this.imei_type, phone_list: this.phone_list, client_type: 2, is_purchase: this.is_purchase, ...this.form }).then(res => {
|
||
this.btnLoading = false
|
||
if (res.errcode === 0) {
|
||
if (!!res.datas.total_repeat_num && res.datas.total_repeat_num.length > 0) {
|
||
this.$parent.repeatshow = true
|
||
this.$parent.repeatdata = []
|
||
res.datas.total_repeat_num.map(e => {
|
||
e.repeat_num.map(k => {
|
||
this.$parent.repeatdata.push({ ...k, imei: e.imei, open: false, add: false, addshow: true })
|
||
})
|
||
})
|
||
} else {
|
||
this.resetinfo()
|
||
this.$parent.getlist()
|
||
}
|
||
this.handleClose()
|
||
this.form = {}
|
||
}
|
||
})
|
||
}
|
||
}
|
||
} else if (res.errcode == 1201) { // 申请退货
|
||
if (this.is_purchase != 1) { // 入库
|
||
this.$parent.applyshow = true
|
||
this.$parent.applylist = res.datas
|
||
this.$parent.filterlist = this.phone_list.filter((v) => !res.datas.some((k) => { return k.origin_imei == v.imei1 || k.origin_imei == v.imei2 || k.origin_imei == v.sn }))
|
||
console.log(this.$parent.filterlist)
|
||
this.handleClose()
|
||
}
|
||
}
|
||
})
|
||
}
|
||
} else {
|
||
if (this.number) {
|
||
batch_save_drafts_box({ is_warranty_query: this.is_warranty_query, imei_type: this.imei_type, phone_list: this.phone_list, client_type: 2, is_purchase: this.is_purchase, ...this.form }).then(res => {
|
||
this.btnLoading = false
|
||
if (res.errcode === 0) {
|
||
console.log(this.form)
|
||
this.resetinfo()
|
||
this.form = {}
|
||
this.$parent.getlist()
|
||
this.handleClose()
|
||
}
|
||
})
|
||
} else {
|
||
this.btnLoading = false
|
||
this.$message({ type: 'warning', message: '请输入机器数量' })
|
||
}
|
||
}
|
||
} else {
|
||
this.btnLoading = false
|
||
this.$message({ type: 'warning', message: this.formLabelAlign['warehousing_type'] == 1 ? '客户和价格必须填写' : '客户必须填写' })
|
||
}
|
||
},
|
||
filterfunction() {
|
||
if (this.is_purchase != 2) {
|
||
third_party_no({ p_user_id: this.formLabelAlign.subsidiary, is_purchase: this.is_purchase, phone_list: this.phone_list }).then((res) => {
|
||
if (res.errcode == 0) {
|
||
if (res.datas.length != 0) { // 拍机堂数据或者采购单数据
|
||
const len = res.datas.length
|
||
if (len >= 1) { // 不是采购单数据或存在采购单里只有1条
|
||
this.handleClose()
|
||
// 保存实物数据
|
||
this.$parent.pjtdata = []
|
||
res.datas.map(e => {
|
||
if (!e.pjt_info.every(s => { return !!s.res_id })) { // 未生成采购单的显示
|
||
e.pjt_info.map(k => {
|
||
// if (!k.res_id) {
|
||
this.$parent.pjtdata.push({ ...k, imei: e.imei, open: false, add: false, addshow: true })
|
||
// }
|
||
})
|
||
this.$parent.pjtshow = true
|
||
this.$parent.is_batch = true
|
||
}
|
||
})
|
||
if (this.$parent.is_batch == false) {
|
||
batch_save_drafts_box({ is_warranty_query: this.is_warranty_query, imei_type: this.imei_type, phone_list: this.phone_list, client_type: 2, is_purchase: this.is_purchase, ...this.form }).then(res => {
|
||
if (res.errcode === 0) {
|
||
if (!!res.datas.total_repeat_num && res.datas.total_repeat_num.length > 0) {
|
||
this.$parent.repeatshow = true
|
||
this.$parent.repeatdata = []
|
||
res.datas.total_repeat_num.map(e => {
|
||
e.repeat_num.map(k => {
|
||
this.$parent.repeatdata.push({ ...k, imei: e.imei, open: false, add: false, addshow: true })
|
||
})
|
||
})
|
||
this.$parent.is_batch = true
|
||
} else {
|
||
this.resetinfo()
|
||
this.form = {}
|
||
this.$parent.getlist()
|
||
}
|
||
this.handleClose()
|
||
this.$parent.filtershow = false
|
||
this.$parent.filterlist = []
|
||
}
|
||
})
|
||
}
|
||
}
|
||
} else {
|
||
batch_save_drafts_box({ is_warranty_query: this.is_warranty_query, imei_type: this.imei_type, phone_list: this.phone_list, client_type: 2, is_purchase: this.is_purchase, ...this.form }).then(res => {
|
||
if (res.errcode === 0) {
|
||
if (!!res.datas.total_repeat_num && res.datas.total_repeat_num.length > 0) {
|
||
this.$parent.repeatshow = true
|
||
this.$parent.repeatdata = []
|
||
res.datas.total_repeat_num.map(e => {
|
||
e.repeat_num.map(k => {
|
||
this.$parent.repeatdata.push({ ...k, imei: e.imei, open: false, add: false, addshow: true })
|
||
})
|
||
})
|
||
} else {
|
||
this.resetinfo()
|
||
this.$parent.getlist()
|
||
}
|
||
this.$parent.filtershow = false
|
||
this.$parent.filterlist = []
|
||
this.handleClose()
|
||
this.form = {}
|
||
}
|
||
})
|
||
}
|
||
} else if (res.errcode == 1201) { // 申请退货
|
||
if (this.is_purchase != 1) { // 入库
|
||
this.$parent.applyshow = true
|
||
this.$parent.applylist = res.datas
|
||
this.$parent.filterlist = this.phone_list.filter((v) => !res.datas.some((k) => { return k.origin_imei == v.imei1 || k.origin_imei == v.imei2 || k.origin_imei == v.sn }))
|
||
this.handleClose()
|
||
}
|
||
}
|
||
})
|
||
} else {
|
||
batch_save_drafts_box({ is_warranty_query: this.is_warranty_query, imei_type: this.imei_type, phone_list: this.phone_list, client_type: 2, is_purchase: this.is_purchase, ...this.form }).then(res => {
|
||
if (res === 0) {
|
||
this.resetinfo()
|
||
this.form = {}
|
||
this.$parent.getlist()
|
||
this.handleClose()
|
||
}
|
||
})
|
||
}
|
||
},
|
||
editchange(change, name) {
|
||
if (change) {
|
||
this.$set(this, name, '')
|
||
}
|
||
},
|
||
getcate() {
|
||
cate_brand_list().then(res => {
|
||
this.current = [this.brandform.cate_id]
|
||
this.cate_options = res.datas.datas
|
||
})
|
||
res_advanced_search({ p_user_id: this.$parent.formLabelAlign.subsidiary }).then(e => {
|
||
this.op_user_id_options = e.datas['op_user_id']
|
||
this.quote_user_options = e.datas['quote_user_id']
|
||
this.customer_options = e.datas['supplier_info']
|
||
this.grade_options = e.datas['rk_grade_list']
|
||
this.network_options = e.datas['network']
|
||
})
|
||
},
|
||
getbrand(page) {
|
||
cate_brand_list({ cate_id: this.brandform.cate_id, list_row: 15, page: page, default_brand_id: this.default_brand_id }).then(res => {
|
||
this.brand_options = res.datas.datas
|
||
this.brandtotal = res.datas.total
|
||
})
|
||
},
|
||
getmodel(page) {
|
||
cate_brand_list({ cate_id: this.brandform.cate_id, list_row: 15, page: page, brand_id: this.brandform.brand_id, default_model_id: this.default_model_id, default_brand_id: this.default_brand_id }).then(res => {
|
||
this.model_options = res.datas.datas
|
||
this.modeltotal = res.datas.total
|
||
})
|
||
},
|
||
async handleSelect(data) {
|
||
this.brandform.cate_id = data.cate_id
|
||
this.brandform.brand_id = data.brand_id
|
||
this.default_brand_id = data.brand_id
|
||
this.default_model_id = data.model_id
|
||
this.brandform.model_id = data.model_id
|
||
this.brandform.rom_id = null
|
||
this.brandform.color_id = null
|
||
await this.getbrand()
|
||
await this.getmodel()
|
||
await this.getromcolor()
|
||
},
|
||
getromcolor(page) {
|
||
cate_brand_list({ cate_id: this.brandform.cate_id, list_row: 15, page: page, brand_id: this.brandform.brand_id, model_id: this.brandform.model_id, default_model_id: this.default_model_id, default_brand_id: this.default_brand_id }).then(res => {
|
||
this.rom_options = res.datas.datas['rom_list']
|
||
this.color_options = res.datas.datas['color_list']
|
||
this.romtotal = res.datas.total
|
||
})
|
||
},
|
||
editinfo() {
|
||
if (this.brandform.res_id) { // 采购单
|
||
purchase_order_edit_phone(this.brandform).then(res => {
|
||
this.$parent.getlist()
|
||
this.handleClose()
|
||
})
|
||
} else {
|
||
edit_drafts_box({ ...this.brandform, client_type: 2 }).then(res => {
|
||
this.$parent.getlist()
|
||
this.handleClose()
|
||
})
|
||
}
|
||
},
|
||
change(val, name) {
|
||
if (name == 'cate_id') {
|
||
this.$set(this.form, 'brand_id', null)
|
||
this.$set(this.form, 'model_id', null)
|
||
this.$set(this.form, 'rom_id', null)
|
||
this.$set(this.form, 'color_id', null)
|
||
if (val) {
|
||
cate_brand_list_all({ cate_id: val }).then(res => {
|
||
this.brand_options = res.datas
|
||
})
|
||
} else {
|
||
this.brand_options = []
|
||
this.rom_options = []
|
||
this.color_options = []
|
||
}
|
||
} else if (name == 'brand_id') {
|
||
this.$set(this.form, 'model_id', null)
|
||
this.$set(this.form, 'rom_id', null)
|
||
this.$set(this.form, 'color_id', null)
|
||
if (val) {
|
||
cate_brand_list_all({ cate_id: this.form.cate_id, brand_id: val }).then(res => {
|
||
this.model_options = res.datas
|
||
})
|
||
} else {
|
||
this.model_options = []
|
||
this.rom_options = []
|
||
this.color_options = []
|
||
}
|
||
} else {
|
||
this.$set(this.form, 'rom_id', null)
|
||
this.$set(this.form, 'color_id', null)
|
||
if (val) {
|
||
cate_brand_list_all({ cate_id: this.form.cate_id, brand_id: this.form.brand_id, model_id: val }).then(res => {
|
||
this.rom_options = res.datas['rom_list']
|
||
this.color_options = res.datas['color_list']
|
||
})
|
||
} else {
|
||
this.rom_options = []
|
||
this.color_options = []
|
||
}
|
||
}
|
||
},
|
||
brandclick(e, v) {
|
||
let target = e.target
|
||
if (target.nodeName === 'SPAN') {
|
||
target = e.target.parentNode
|
||
}
|
||
target.blur()
|
||
this.brandform.brand_id = v.value
|
||
this.getmodel()
|
||
},
|
||
modelclick(e, v) {
|
||
let target = e.target
|
||
if (target.nodeName === 'SPAN') {
|
||
target = e.target.parentNode
|
||
}
|
||
target.blur()
|
||
this.brandform.model_id = v.value
|
||
this.getromcolor()
|
||
},
|
||
romclick(e, v) {
|
||
let target = e.target
|
||
if (target.nodeName === 'SPAN') {
|
||
target = e.target.parentNode
|
||
}
|
||
target.blur()
|
||
this.$set(this.form, 'rom_id', v.value)
|
||
},
|
||
colorclick(e, v) {
|
||
let target = e.target
|
||
if (target.nodeName === 'SPAN') {
|
||
target = e.target.parentNode
|
||
}
|
||
target.blur()
|
||
this.$set(this.form, 'color_id', v.value)
|
||
},
|
||
currentchange(data) {
|
||
this.getbrand(data)
|
||
},
|
||
currentchange1(data) {
|
||
this.getmodel(data)
|
||
},
|
||
currentchange2(data) {
|
||
this.getromcolor(data)
|
||
},
|
||
handleClose() {
|
||
this.btnLoading = false
|
||
this.$emit('update:batchshow', false)
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="less" scoped>
|
||
.topclass{
|
||
width: 450px;
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: space-between;
|
||
}
|
||
.bodyclass{
|
||
margin-top:10px;
|
||
display: flex;
|
||
height: 820px;
|
||
}
|
||
.bodyclass ::v-deep .el-button{
|
||
padding: 8px;
|
||
}
|
||
// .btnclass ::v-deep .el-button--primary:focus{
|
||
// margin-right: 12px;
|
||
// border-radius: 2px;
|
||
// box-shadow: 0 2px 4px 0 #f4f4f4;
|
||
// color: #2794f8;
|
||
// background: white;
|
||
// }
|
||
.btnclass ::v-deep .el-button--primary:hover{
|
||
border-radius: 2px;
|
||
color: #2794f8;
|
||
background: #d2e6fc;
|
||
border-color:#b3d8ff ;
|
||
}
|
||
.body {
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
.body-text {
|
||
// display: flex;
|
||
// flex-direction: column;
|
||
margin-bottom: 15px;
|
||
}
|
||
.header {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
margin-bottom: 25px;
|
||
}
|
||
.text {
|
||
font-size: 20px;
|
||
font-weight: bold;
|
||
}
|
||
.text1 {
|
||
font-size: 18px;
|
||
// height: 20px;
|
||
}
|
||
.calculation {
|
||
border: 1px solid #ebeef5;
|
||
padding: 10px;
|
||
font-size: 14px;
|
||
span {
|
||
padding: 0 10px;
|
||
display: inline-block;
|
||
}
|
||
}
|
||
table,td,th {
|
||
border: 1px solid #d4d4d4;
|
||
}
|
||
|
||
table {
|
||
border-collapse: collapse;
|
||
height: 100px;
|
||
width: 100%;
|
||
}
|
||
|
||
.label{
|
||
display: inline-block;
|
||
width: 62px;
|
||
}
|
||
|
||
th {
|
||
height: 65px;
|
||
}
|
||
.top{
|
||
display: flex;
|
||
background-color:#4ca48c;
|
||
height:60px
|
||
}
|
||
.top-text{
|
||
font-family: STHeiti;
|
||
color: #fff;
|
||
font-size: 26px;
|
||
text-align: center;
|
||
}
|
||
.top-text1{
|
||
font-family: STHeiti;
|
||
color: #fff;
|
||
font-size: 12px;
|
||
}
|
||
.fotter-top{
|
||
display: flex;
|
||
background-color:#4ca48c;
|
||
height:60px;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
padding: 0 30px;
|
||
}
|
||
.footer-Toptext{
|
||
font-family: STHeiti;
|
||
color: #fff;
|
||
font-size: 24px;
|
||
}
|
||
.fotter-main{
|
||
display: flex;
|
||
// background-color:#fff;
|
||
height:30px;
|
||
justify-content: center;
|
||
}
|
||
.footer-maintext{
|
||
font-family: STHeiti;
|
||
color:#FFFFFF;
|
||
font-size: 20px;
|
||
}
|
||
.el-col-6{
|
||
width: 20%!important;
|
||
}
|
||
.level{
|
||
display: inline-block;
|
||
height: 20px;
|
||
line-height: 20px;
|
||
padding: 0 15px;
|
||
background: #ff633c;
|
||
border-radius: 12px;
|
||
font-size: 12px;;
|
||
font-weight: 500;
|
||
color: #fff;
|
||
cursor: pointer;
|
||
margin:0px 10px;
|
||
}
|
||
.paiclass{
|
||
height: 40px;
|
||
background: #f2f2f2;
|
||
display: flex;
|
||
font-size: 16px;
|
||
align-items: center;
|
||
}
|
||
|
||
.top-select{
|
||
margin-bottom:5px;
|
||
width:100%;
|
||
margin-top:20px
|
||
}
|
||
</style>
|