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

客户编辑等bug

parent 01e36148
...@@ -14,5 +14,8 @@ ...@@ -14,5 +14,8 @@
"bin", "bin",
"public", "public",
"src/i18n/" "src/i18n/"
] ],
"vueCompilerOptions":{
"target": 2
}
} }
\ No newline at end of file
...@@ -236,3 +236,19 @@ export function infoListReceiptPage(params){ ...@@ -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> <template>
<el-table <el-table
border border
:data="tableData" :data="exportWarehouseList"
style=""> style="">
<el-table-column <el-table-column
width="250px" width="250px"
label="始发地"> label="始发地">
<template v-slot="{ row, column, $index }"> <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> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="objectiveId" prop="objectiveId"
label="目的地"> label="目的地">
<template v-slot="{ row, column, $index }"> <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 <el-option
v-for="item in importCityList" v-for="item in importWarehouseList"
:key="item.id" :key="item.id"
:label="item.titleZh" :label="$l(item, 'title')"
:value="item.id"> :value="item.id">
</el-option> </el-option>
</el-select> </el-select>
...@@ -41,64 +41,52 @@ export default { ...@@ -41,64 +41,52 @@ export default {
}, },
data() { data() {
return { return {
tableData: [] tableData: [],
importWarehouseList: [],
exportWarehouseList: []
} }
}, },
mounted() { mounted() {
this.freshTableData() this.initLines()
}, },
methods: { methods: {
/** initLines(){
* 解析 value this.warehouseList.forEach(item => {
*/ if(item.tradeType == 2 || item.tradeType == 3){
freshTableData(){ let oldItem = this.value.find(it => it.departureId == item.id)
const foo = [] this.exportWarehouseList.push(Object.assign({}, item, {
let index = 0 checked: !!oldItem,
this.warehouseList.forEach(e => { objectiveIdArr: oldItem ? oldItem.objectiveIds.split(',').map(item => +item) : []
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))
} }
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');
}, },
/** getValue(){
* 更新 value let arr = []
*/ this.exportWarehouseList.forEach(item => {
updateValue(really = true){ if(item.checked){
if (!really) return arr.push({
const result = [] objectiveIds: item.objectiveIdArr.join(','),
this.tableData.forEach(e => { departureId: item.id,
if(e.checked){ zhongPaoType: this.zhongPaoType
const { departureId } = e })
let objectiveIds = e.objectiveIds.join(',')
result.push({ departureId, objectiveIds, zhongPaoType: this.zhongPaoType })
} }
}) })
this.$emit('input', result) return arr
},
emit(){
this.$emit('input', this.getValue())
} }
}, },
watch: { watch: {
value() { value() {
this.freshTableData() // this.freshTableData()
}, },
warehouseList() { 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 @@ ...@@ -182,7 +182,7 @@
<el-col :span="24" v-show="showZhong"> <el-col :span="24" v-show="showZhong">
<el-form-item :label="$t('指定线路')" prop="line"> <el-form-item :label="$t('指定线路')" prop="line">
<el-switch v-model="showZhong1"></el-switch> <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-form-item>
</el-col> </el-col>
<el-col :span="13"> <el-col :span="13">
...@@ -196,7 +196,7 @@ ...@@ -196,7 +196,7 @@
<el-col :span="24" v-show="showPao"> <el-col :span="24" v-show="showPao">
<el-form-item :label="$t('指定线路')" prop="line"> <el-form-item :label="$t('指定线路')" prop="line">
<el-switch v-model="showPao1"></el-switch> <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-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -281,9 +281,10 @@ ...@@ -281,9 +281,10 @@
> >
<template v-slot = "{row}"> <template v-slot = "{row}">
<el-form-item label=""> <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-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> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
...@@ -410,6 +411,7 @@ import { ...@@ -410,6 +411,7 @@ import {
getCustomerPage, memberUserList, getCustomerPage, memberUserList,
updateCustomer, updateCustomer,
userMemberUserList, userMemberUserList,
getCustomerLines
} from '@/api/ecw/customer' } from '@/api/ecw/customer'
import {getNodeList} from "@/api/ecw/node" import {getNodeList} from "@/api/ecw/node"
import { getProductTypeList } from '@/api/ecw/productType' import { getProductTypeList } from '@/api/ecw/productType'
...@@ -424,7 +426,8 @@ import { getCustomerContactsListByCustomer } from '@/api/ecw/customerContacts' ...@@ -424,7 +426,8 @@ import { getCustomerContactsListByCustomer } from '@/api/ecw/customerContacts'
import { getCountryListAll } from '@/api/ecw/country' import { getCountryListAll } from '@/api/ecw/country'
import Template from "@/views/cms/template"; import Template from "@/views/cms/template";
import {validatorMobile} from "@/api/ecw/validate" 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 { export default {
name: "edit", name: "edit",
...@@ -434,13 +437,14 @@ export default { ...@@ -434,13 +437,14 @@ export default {
components: { components: {
Template, Template,
upload, upload,
CustomerLineTable CustomerLineTable,
MemberSelector
}, },
created() { created() {
this.isCustomerServiceConfirmed = this.$route.query.isCustomerServiceConfirmed ? true : false this.isCustomerServiceConfirmed = this.$route.query.isCustomerServiceConfirmed ? true : false
this.getCustomerSelect() this.getCustomerSelect()
this.reset() this.reset()
this.getUserMemberUserFn() // this.getUserMemberUserFn()
if(this.customerId !== '0') { if(this.customerId !== '0') {
// 编辑客户 // 编辑客户
this.getCustomer(this.customerId).then(() => { this.getCustomer(this.customerId).then(() => {
...@@ -458,6 +462,25 @@ export default { ...@@ -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 { } else {
// 新建客户 // 新建客户
...@@ -545,11 +568,11 @@ export default { ...@@ -545,11 +568,11 @@ export default {
}, },
methods: { methods: {
getUserMemberUserFn(val){ /* getUserMemberUserFn(val){
userMemberUserList({pageNo:1,pageSize:100,searchKey:val}).then(r => { userMemberUserList({pageNo:1,pageSize:100,searchKey:val}).then(r => {
this.memberList = r.data.list this.memberList = r.data.list
}) })
}, }, */
remoteMethod(val){ remoteMethod(val){
this.getCustomerSelect(val); this.getCustomerSelect(val);
}, },
...@@ -599,7 +622,7 @@ export default { ...@@ -599,7 +622,7 @@ export default {
this.form.customerContacts[0].isDefault = 1 this.form.customerContacts[0].isDefault = 1
} }
}, },
selectBD(val){ /* selectBD(val){
if(!val){ if(!val){
return return
} }
...@@ -607,8 +630,8 @@ export default { ...@@ -607,8 +630,8 @@ export default {
if(i === undefined){ if(i === undefined){
this.selectMemberList.push(this.memberList.find(item => item.id === val)) this.selectMemberList.push(this.memberList.find(item => item.id === val))
} }
this.getUserMemberUserFn() // this.getUserMemberUserFn()
}, }, */
/** 取消按钮 */ /** 取消按钮 */
cancel() { cancel() {
this.$tab.closePage() this.$tab.closePage()
...@@ -765,12 +788,12 @@ export default { ...@@ -765,12 +788,12 @@ export default {
userId(){ userId(){
return this.$store.state.user.id return this.$store.state.user.id
}, },
userMemberUser(){ /* userMemberUser(){
let list = this.memberList.filter(item => { let list = this.memberList.filter(item => {
return this.selectMemberList.findIndex(i => i.id === item.id) < 0 return this.selectMemberList.findIndex(i => i.id === item.id) < 0
}) })
return [...this.selectMemberList,...list] return [...this.selectMemberList,...list]
}, }, */
productListFilter(){ productListFilter(){
return this.productList.filter((p) => p.typeId === this.form.productType) return this.productList.filter((p) => p.typeId === this.form.productType)
}, },
...@@ -788,11 +811,11 @@ export default { ...@@ -788,11 +811,11 @@ export default {
}, },
watch: { watch: {
zhongLines() { zhongLines() {
console.log('zhongLines') console.log('zhongLines', this.zhongLines)
this.updateCustomerLines() this.updateCustomerLines()
}, },
paoLines() { paoLines() {
console.log('paoLines') console.log('paoLines', this.paoLines)
this.updateCustomerLines() this.updateCustomerLines()
} }
} }
......
...@@ -356,7 +356,7 @@ ...@@ -356,7 +356,7 @@
</el-table-column> </el-table-column>
<el-table-column label=""> <el-table-column label="">
<template slot-scope="{row}"> <template slot-scope="{row}">
-{{row.reduceAmount}} -{{row.reduceTotalAmount}}
{{currencyMap[row.reduceCurrencyId]}} {{currencyMap[row.reduceCurrencyId]}}
</template> </template>
</el-table-column> </el-table-column>
...@@ -678,7 +678,7 @@ export default { ...@@ -678,7 +678,7 @@ export default {
titleZh: it.titleZh, titleZh: it.titleZh,
titleEn: it.titleEn, titleEn: it.titleEn,
endTime: it.endTime, endTime: it.endTime,
reduceAmount: it.reduceAmount, reduceTotalAmount: it.reduceTotalAmount,
reduceCurrencyId: it.reduceCurrencyId reduceCurrencyId: it.reduceCurrencyId
}) })
} }
...@@ -736,7 +736,7 @@ export default { ...@@ -736,7 +736,7 @@ export default {
} }
let coupon = this.couponList.find(coupon => coupon.reduceCurrencyId == item.currencyId) let coupon = this.couponList.find(coupon => coupon.reduceCurrencyId == item.currencyId)
if(coupon){ 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){ if(this.form.otherFee && this.form.otherFeeCurrencyId == item.currencyId){
it.amount = it.amount.plus(this.form.otherFee) it.amount = it.amount.plus(this.form.otherFee)
......
...@@ -1110,7 +1110,8 @@ export default { ...@@ -1110,7 +1110,8 @@ export default {
lineId: this.form.lineId, lineId: this.form.lineId,
transportId: this.form.transportId, transportId: this.form.transportId,
channelId: [3,4].indexOf(this.form.transportId) > -1 ? this.form.channelId : undefined, channelId: [3,4].indexOf(this.form.transportId) > -1 ? this.form.channelId : undefined,
prodConditionParamList: this.getProductListWithDefaultValue() prodConditionParamList: this.getProductListWithDefaultValue(),
orderType: this.form.orderType
}).then(res => { }).then(res => {
this.$set(this, 'fee', res.data.costDto) this.$set(this, 'fee', res.data.costDto)
this.form.orderItemVOList.map((item, index) => { this.form.orderItemVOList.map((item, index) => {
...@@ -1129,6 +1130,7 @@ export default { ...@@ -1129,6 +1130,7 @@ export default {
if(!tmp.weight)tmp.weight = 1 if(!tmp.weight)tmp.weight = 1
if(!tmp.quantity)tmp.quantity = 1 if(!tmp.quantity)tmp.quantity = 1
if(!tmp.num)tmp.num = 1 if(!tmp.num)tmp.num = 1
tmp.orderType = item.orderItemType
arr.push(tmp) arr.push(tmp)
}) })
return arr return arr
......
...@@ -436,7 +436,7 @@ export default { ...@@ -436,7 +436,7 @@ export default {
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); // this.reset();
const id = row.id; const id = row.id;
getProduct(id).then(response => { getProduct(id).then(response => {
this.form = {...response.data}; this.form = {...response.data};
...@@ -446,7 +446,7 @@ export default { ...@@ -446,7 +446,7 @@ export default {
attrArray[index] = parseInt(value); attrArray[index] = parseInt(value);
} }
this.$nextTick(() =>{ this.$nextTick(() =>{
this.form.attrArray = attrArray this.$set(this.form, 'attrArray', attrArray)
}) })
this.open = true; this.open = true;
this.title = this.$t("修改商品"); this.title = this.$t("修改商品");
......
...@@ -152,7 +152,7 @@ ...@@ -152,7 +152,7 @@
<el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')">展开/折叠</el-checkbox> <el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')">展开/折叠</el-checkbox>
<el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($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" <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-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <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