Commit 48472f98 authored by dragondean@qq.com's avatar dragondean@qq.com

客户编辑等bug

parent 01e36148
......@@ -14,5 +14,8 @@
"bin",
"public",
"src/i18n/"
]
],
"vueCompilerOptions":{
"target": 2
}
}
\ No newline at end of file
......@@ -236,3 +236,19 @@ export function infoListReceiptPage(params){
})
}
// 获取用户
export function getMember(id){
return request({
url: "/member/user/get",
params: {id}
})
}
// 获得客户路线
export function getCustomerLines(customerId){
return request({
url: '/ecw/customer-line/get-by-customer',
params: {customerId}
})
}
<template>
<el-table
border
:data="tableData"
:data="exportWarehouseList"
style="">
<el-table-column
width="250px"
label="始发地">
<template v-slot="{ row, column, $index }">
<el-checkbox v-model="row.checked" @change="updateValue(true)">{{ warehouseList[$index].titleZh }}</el-checkbox>
<el-checkbox v-model="row.checked" @change="emit">{{ $l(row, 'title') }}</el-checkbox>
</template>
</el-table-column>
<el-table-column
prop="objectiveId"
label="目的地">
<template v-slot="{ row, column, $index }">
<el-select v-model="tableData[$index].objectiveIds" multiple placeholder="请选择" style="width:100%" @change="updateValue(row.checked)">
<el-select v-model="row.objectiveIdArr" multiple placeholder="请选择" style="width:100%" @change="emit">
<el-option
v-for="item in importCityList"
v-for="item in importWarehouseList"
:key="item.id"
:label="item.titleZh"
:label="$l(item, 'title')"
:value="item.id">
</el-option>
</el-select>
......@@ -41,64 +41,52 @@ export default {
},
data() {
return {
tableData: []
tableData: [],
importWarehouseList: [],
exportWarehouseList: []
}
},
mounted() {
this.freshTableData()
this.initLines()
},
methods: {
/**
* 解析 value
*/
freshTableData(){
const foo = []
let index = 0
this.warehouseList.forEach(e => {
let bar = this.tableData.length > 0 ? this.tableData[index] : {
departureId: e.id,
objectiveIds: [],
tradeType:e.tradeType,
checked: false
}
const valueIndex = this.value.findIndex(v => v.departureId === e.id)
if(valueIndex !== -1) {
bar = { ...this.value[valueIndex], checked: true }
if(bar.objectiveIds.length === 0) {
bar.objectiveIds = []
} else {
bar.objectiveIds = bar.objectiveIds.split(',').map(m => parseInt(m))
initLines(){
this.warehouseList.forEach(item => {
if(item.tradeType == 2 || item.tradeType == 3){
let oldItem = this.value.find(it => it.departureId == item.id)
this.exportWarehouseList.push(Object.assign({}, item, {
checked: !!oldItem,
objectiveIdArr: oldItem ? oldItem.objectiveIds.split(',').map(item => +item) : []
}))
}
if(item.tradeType == 1 || item.tradeType == 3){
this.importWarehouseList.push(Object.assign({}, item))
}
foo.push(bar)
index++
})
this.tableData = foo.filter(i => i.tradeType === '2');
},
/**
* 更新 value
*/
updateValue(really = true){
if (!really) return
const result = []
this.tableData.forEach(e => {
if(e.checked){
const { departureId } = e
let objectiveIds = e.objectiveIds.join(',')
result.push({ departureId, objectiveIds, zhongPaoType: this.zhongPaoType })
getValue(){
let arr = []
this.exportWarehouseList.forEach(item => {
if(item.checked){
arr.push({
objectiveIds: item.objectiveIdArr.join(','),
departureId: item.id,
zhongPaoType: this.zhongPaoType
})
}
})
this.$emit('input', result)
return arr
},
emit(){
this.$emit('input', this.getValue())
}
},
watch: {
value() {
this.freshTableData()
// this.freshTableData()
},
warehouseList() {
this.freshTableData()
this.initLines()
}
}
}
......
<template>
<el-select
v-model="index"
filterable
clearable
remote
reserve-keyword
:placeholder="$t('请输入关键词')"
:remote-method="remoteMethod"
:loading="loading"
:size="size">
<el-option
v-for="(item, index) in list"
:key="item.id"
:label="`${item.nickname}(${item.mobile})`"
:value="index">
</el-option>
</el-select>
</template>
<script>
import {userMemberUserList, getMember} from '@/api/ecw/customer'
export default {
props:{
productType: [String, Number],
value: [String, Number],
size: String
},
data(){
return {
index: null,
list:[],
loading: false
}
},
watch:{
index(val){
this.$emit('input', (val!==''&&val !== null) ? this.list[val].id: null)
this.$emit('change', (val!==''&&val !== null) ? this.list[val]: null)
},
value(val){
this.init()
}
},
created(){
this.init()
},
methods:{
init(){
if(!this.value) return
let index = this.list.findIndex(item => item.id == this.value)
if(index < 0){
getMember(this.value).then(res => {
if(!res.data) rurn
this.list.unshift(res.data)
this.index = 0
})
}
},
remoteMethod(keyword){
let params = {
pageSize: 100
}
params.searchKey = keyword
this.loading = true
userMemberUserList(params)
.then(res => this.list = res.data.list)
.finally(() => this.loading = false)
}
}
}
</script>
......@@ -182,7 +182,7 @@
<el-col :span="24" v-show="showZhong">
<el-form-item :label="$t('指定线路')" prop="line">
<el-switch v-model="showZhong1"></el-switch>
<customer-line-table v-show="showZhong1" :warehouse-list="warehouseList" :import-city-list="importCityList" v-model="zhongLines" :zhong-pao-type="0"></customer-line-table>
<customer-line-table v-if="showZhong1" :warehouse-list="warehouseList" :import-city-list="importCityList" v-model="zhongLines" :zhong-pao-type="1"></customer-line-table>
</el-form-item>
</el-col>
<el-col :span="13">
......@@ -196,7 +196,7 @@
<el-col :span="24" v-show="showPao">
<el-form-item :label="$t('指定线路')" prop="line">
<el-switch v-model="showPao1"></el-switch>
<customer-line-table v-show="showPao1" :warehouse-list="warehouseList" :import-city-list="importCityList" v-model="paoLines" :zhong-pao-type="1"></customer-line-table>
<customer-line-table v-if="showPao1" :warehouse-list="warehouseList" :import-city-list="importCityList" v-model="paoLines" :zhong-pao-type="2"></customer-line-table>
</el-form-item>
</el-col>
</el-row>
......@@ -281,9 +281,10 @@
>
<template v-slot = "{row}">
<el-form-item label="">
<el-select v-model="row.userid" clearable remote :remote-method="getUserMemberUserFn" @change="selectBD" size="mini" filterable>
<!-- <el-select v-model="row.userid" clearable remote :remote-method="getUserMemberUserFn" @change="selectBD" size="mini" filterable>
<el-option v-for="(item,index) in userMemberUser" :value="item.id" :key="index" :label="item.nickname + '(' + item.mobile + ')'" ></el-option>
</el-select>
</el-select> -->
<MemberSelector v-model="row.userid" size="mini" />
</el-form-item>
</template>
</el-table-column>
......@@ -410,6 +411,7 @@ import {
getCustomerPage, memberUserList,
updateCustomer,
userMemberUserList,
getCustomerLines
} from '@/api/ecw/customer'
import {getNodeList} from "@/api/ecw/node"
import { getProductTypeList } from '@/api/ecw/productType'
......@@ -424,7 +426,8 @@ import { getCustomerContactsListByCustomer } from '@/api/ecw/customerContacts'
import { getCountryListAll } from '@/api/ecw/country'
import Template from "@/views/cms/template";
import {validatorMobile} from "@/api/ecw/validate"
import {customerDropDownList} from "@/api/ecw/customerCommissionInfo";
// import {customerDropDownList} from "@/api/ecw/customerCommissionInfo";
import MemberSelector from '@/components/MemberSelector'
export default {
name: "edit",
......@@ -434,13 +437,14 @@ export default {
components: {
Template,
upload,
CustomerLineTable
CustomerLineTable,
MemberSelector
},
created() {
this.isCustomerServiceConfirmed = this.$route.query.isCustomerServiceConfirmed ? true : false
this.getCustomerSelect()
this.reset()
this.getUserMemberUserFn()
// this.getUserMemberUserFn()
if(this.customerId !== '0') {
// 编辑客户
this.getCustomer(this.customerId).then(() => {
......@@ -458,6 +462,25 @@ export default {
})
}
})
// 打开重泡货开关
if(this.form.weightUnit){
this.showZhong = true
}
if(this.form.lightUnit){
this.showPao = true
}
// 获取重泡货路线
getCustomerLines(this.customerId).then(res => {
console.log({getCustomerLines: res})
this.zhongLines = res.data.filter(item => item.zhongPaoType == 1)
this.paoLines = res.data.filter(item => item.zhongPaoType == 2)
if(this.zhongLines.length)this.showZhong1 = true
if(this.paoLines.length) this.showPao1 = true
// /admin-api/customer-line/get-by-customer
// /admin-api/customer-line/get-by-customer?customerId=29564
})
})
} else {
// 新建客户
......@@ -545,11 +568,11 @@ export default {
},
methods: {
getUserMemberUserFn(val){
/* getUserMemberUserFn(val){
userMemberUserList({pageNo:1,pageSize:100,searchKey:val}).then(r => {
this.memberList = r.data.list
})
},
}, */
remoteMethod(val){
this.getCustomerSelect(val);
},
......@@ -599,7 +622,7 @@ export default {
this.form.customerContacts[0].isDefault = 1
}
},
selectBD(val){
/* selectBD(val){
if(!val){
return
}
......@@ -607,8 +630,8 @@ export default {
if(i === undefined){
this.selectMemberList.push(this.memberList.find(item => item.id === val))
}
this.getUserMemberUserFn()
},
// this.getUserMemberUserFn()
}, */
/** 取消按钮 */
cancel() {
this.$tab.closePage()
......@@ -765,12 +788,12 @@ export default {
userId(){
return this.$store.state.user.id
},
userMemberUser(){
/* userMemberUser(){
let list = this.memberList.filter(item => {
return this.selectMemberList.findIndex(i => i.id === item.id) < 0
})
return [...this.selectMemberList,...list]
},
}, */
productListFilter(){
return this.productList.filter((p) => p.typeId === this.form.productType)
},
......@@ -788,11 +811,11 @@ export default {
},
watch: {
zhongLines() {
console.log('zhongLines')
console.log('zhongLines', this.zhongLines)
this.updateCustomerLines()
},
paoLines() {
console.log('paoLines')
console.log('paoLines', this.paoLines)
this.updateCustomerLines()
}
}
......
......@@ -356,7 +356,7 @@
</el-table-column>
<el-table-column label="">
<template slot-scope="{row}">
-{{row.reduceAmount}}
-{{row.reduceTotalAmount}}
{{currencyMap[row.reduceCurrencyId]}}
</template>
</el-table-column>
......@@ -678,7 +678,7 @@ export default {
titleZh: it.titleZh,
titleEn: it.titleEn,
endTime: it.endTime,
reduceAmount: it.reduceAmount,
reduceTotalAmount: it.reduceTotalAmount,
reduceCurrencyId: it.reduceCurrencyId
})
}
......@@ -736,7 +736,7 @@ export default {
}
let coupon = this.couponList.find(coupon => coupon.reduceCurrencyId == item.currencyId)
if(coupon){
it.amount = it.amount.minus(coupon.reduceAmount)
it.amount = it.amount.minus(coupon.reduceTotalAmount)
}
if(this.form.otherFee && this.form.otherFeeCurrencyId == item.currencyId){
it.amount = it.amount.plus(this.form.otherFee)
......
......@@ -1110,7 +1110,8 @@ export default {
lineId: this.form.lineId,
transportId: this.form.transportId,
channelId: [3,4].indexOf(this.form.transportId) > -1 ? this.form.channelId : undefined,
prodConditionParamList: this.getProductListWithDefaultValue()
prodConditionParamList: this.getProductListWithDefaultValue(),
orderType: this.form.orderType
}).then(res => {
this.$set(this, 'fee', res.data.costDto)
this.form.orderItemVOList.map((item, index) => {
......@@ -1129,6 +1130,7 @@ export default {
if(!tmp.weight)tmp.weight = 1
if(!tmp.quantity)tmp.quantity = 1
if(!tmp.num)tmp.num = 1
tmp.orderType = item.orderItemType
arr.push(tmp)
})
return arr
......
......@@ -436,7 +436,7 @@ export default {
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
// this.reset();
const id = row.id;
getProduct(id).then(response => {
this.form = {...response.data};
......@@ -446,7 +446,7 @@ export default {
attrArray[index] = parseInt(value);
}
this.$nextTick(() =>{
this.form.attrArray = attrArray
this.$set(this.form, 'attrArray', attrArray)
})
this.open = true;
this.title = this.$t("修改商品");
......
......@@ -152,7 +152,7 @@
<el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')">展开/折叠</el-checkbox>
<el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')">全选/全不选</el-checkbox>
<el-tree class="tree-border" :data="menuOptions" show-checkbox ref="menu" node-key="id"
:check-strictly="form.menuCheckStrictly" empty-text="加载中,请稍后" :props="defaultProps"></el-tree>
:check-strictly="true" empty-text="加载中,请稍后" :props="defaultProps"></el-tree>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment