Commit 65aa0080 authored by 李驰骋's avatar 李驰骋

分流要货经销商添加查询条件

与PC端保持一致,支持任意分流
parent c53aa640
......@@ -301,8 +301,8 @@
})
uni.$on('selectAllShuntCode', function(data) {
console.log('监听到事件来自 selectAllShuntCode:', data);
_this.orderItem.shuntDealerName = data.selectAllShuntCode.info.partner
_this.orderItem.shuntDealer = data.selectAllShuntCode.info.partner
_this.orderItem.shuntDealerName = data.selectAllShuntCode.name_org1
_this.orderItem.shuntDealer = data.selectAllShuntCode.partner
})
uni.$on('selectShuntAdressAccountInfo', function(data) {
console.log('监听到事件来自 selectShuntAdressAccountInfo ,携带参数 msg 为:', data);
......@@ -430,9 +430,18 @@
})
},
handleShunt() {
uni.navigateTo({
url: `/pages/select-shunt-list/select-shunt-list?order=${JSON.stringify(this.orderItem)}`
})
// 参考PC端逻辑:根据isRadio判断跳转到哪个页面
if(this.isRadio){
// 有任意分流权限,跳转到全部经销商选择页面
uni.navigateTo({
url: `/pages/select-shunt-all/select-shunt-all?order=${JSON.stringify(this.orderItem)}`
})
}else{
// 普通分流权限,跳转到分流经销商选择页面
uni.navigateTo({
url: `/pages/select-shunt-list/select-shunt-list?order=${JSON.stringify(this.orderItem)}`
})
}
},
handleAdd() {
uni.navigateTo({
......@@ -514,13 +523,17 @@
})
.catch(() => {})
},
bindPickerChange(e,type) {
async bindPickerChange(e,type) {
console.log('picker发送选择改变,携带值为', e.detail.value)
const index = e.detail.value || 0
switch (type) {
case 'shunt':
this.orderItem.isShunt = this.shuntArr[index].value
this.orderItem.shuntName = this.shuntArr[index].name
// 参考PC端逻辑:当选择"是"时,查询分流权限
if(this.orderItem.isShunt === '1'){
await this.getShuntAnyByDealer()
}
break;
case 'shuntType':
this.orderItem.shuntChannelsType = this.shuntTypeArr[index].value
......@@ -940,10 +953,12 @@
.uni-list-cell {
flex: 1;
height: 100%;
align-items: center;
}
.uni-list-cell-db {
flex: 1;
align-items: center;
}
.picker-block {
......@@ -951,8 +966,8 @@
}
.uni-input {
line-height: 100%;
height: 100%;
line-height: 96rpx;
height: 96rpx;
font-size: 14px;
color: $text-base-color;
}
......
......@@ -5,6 +5,39 @@
<image class="header-bg-img" src="@/static/image/nav_bg@3x.png" mode="scaleToFill"></image>
</view>
<view class="main" :style="mainHeight">
<!-- 查询条件 -->
<view class="middle view planout-block-item">
<view class="text-block">
<text class="middle-date">经销商编号</text>
<input class="middle-date-des" type="text" v-model="searchParams.shuntingCustomer"
placeholder="请输入" />
</view>
<view class="text-block">
<text class="middle-date">经销商名称</text>
<input class="middle-date-des" type="text" v-model="searchParams.shuntingCustomerName"
placeholder="请输入" />
</view>
<view class="text-block text-block-last">
<text class="middle-date">渠道类型</text>
<view class="middle-date-des uni-list picker-year">
<view class="uni-list-cell">
<view class="uni-list-cell-db">
<picker class="picker-block" @change="bindPickerChannelChange" :value="channelTypeIndex"
range-key='name' mode="selector" :range="channelTypeArr">
<text class="uni-input-text">{{channelTypeName}}</text>
</picker>
</view>
</view>
<image class="icon-arrow" src="@/static/image/arrow_r@3x.png" mode="aspectFit"></image>
</view>
</view>
</view>
<view class="planout-block">
<button class="btn" type="default" @tap="handleSearch">
<text class="btn-text">查询</text>
</button>
</view>
<list ref="list" class="scroll-area view" loadmoreoffset='100' @loadmore="scrolltolower"
:show-scrollbar='false'>
<refresh @refresh="refresh" :display="refreshing ? 'show' : 'hide'">
......@@ -41,7 +74,9 @@
import {
findByCustomer
findByCustomer,
findByCustomerWithFilter,
querySysDictionaryDetailsByCode
} from '@/servers/purchaseList.js'
import timeFormat from '@/uview-ui/libs/function/timeFormat.js'
......@@ -66,10 +101,21 @@
selectedSalePlan: {},
selectedSalePlanTypes: [],
typesIndex: 0,
lists: [],
orderItem: {}
}
},
lists: [],
orderItem: {},
searchParams: {
shuntingCustomer: '',
shuntingCustomerName: '',
channels: ''
},
channelTypeArr: [{
name: '全部',
value: ''
}],
channelTypeIndex: 0,
channelTypeName: '全部'
}
},
computed: {
...mapState(['sysinfo', 'userInfo']),
navHeight() {
......@@ -103,10 +149,11 @@
// uni.stopPullDownRefresh();
// }, 600);
// },
created() {
this.reset()
this.getSalesPlanTypes(true);
},
created() {
this.reset()
this.getChannelType()
this.getSalesPlanTypes(true);
},
methods: {
handleChecked(item) {
this.selectShuntAccountInfo = item
......@@ -115,14 +162,77 @@
})
uni.navigateBack()
},
handleSearch() {
this.reset()
this.getSalesPlan(true)
},
bindPickerChannelChange(e) {
console.log('bindPickerChannelChange', e.detail.value)
const index = e.detail.value || 0
this.channelTypeIndex = index
this.searchParams.channels = this.channelTypeArr[index].value
this.channelTypeName = this.channelTypeArr[index].name
},
getChannelType() {
querySysDictionaryDetailsByCode({'code': 'A0054'})
.then(res => {
if(res.data.Rows.length > 0){
this.channelTypeArr = [{name: '全部', value: ''}, ...res.data.Rows]
}
})
.catch(() => {})
},
async getSalesPlan(isRefresh) {
if (this.loadParams.isDone) {
return
}
// 构建查询参数
const params = {
'customerCode': this.userInfo.code,
'type': '2',
'customerCode': this.userInfo.code
}
// 使用新的API,支持过滤条件
const conditions = {}
// 自动为编号和名称添加*号进行模糊查询(参考PC端格式)
if (this.searchParams.shuntingCustomer) {
const value = this.searchParams.shuntingCustomer.trim()
if (value) {
conditions.shuntingCustomer = [{
sign: "I",
option: "CP",
low: value.includes('*') ? value : `*${value}*`,
high: ""
}]
}
}
if (this.searchParams.shuntingCustomerName) {
const value = this.searchParams.shuntingCustomerName.trim()
if (value) {
conditions.shuntingCustomerName = [{
sign: "I",
option: "CP",
low: value.includes('*') ? value : `*${value}*`,
high: ""
}]
}
}
// 渠道类型
if (this.searchParams.channels) {
conditions.channels = [{
sign: "I",
option: "EQ",
low: this.searchParams.channels,
high: ""
}]
}
const requestParams = {
...params,
...conditions
}
uni.showLoading({
......@@ -131,7 +241,8 @@
setTimeout(function() {
uni.hideLoading();
}, 2000);
const res = await findByCustomer(params)
const res = await findByCustomerWithFilter(requestParams)
uni.hideLoading();
if (isRefresh) {
......@@ -237,23 +348,12 @@
padding: 0 16rpx;
}
.scroll-area {
overflow-y: scroll;
}
.middle {
background-color: #fff;
border-radius: 16rpx;
padding: 32rpx 64rpx 40rpx 48rpx;
}
.planout-block {
display: flex;
justify-content: space-between;
margin-bottom: 48rpx;
padding: 0 24rpx;
padding: 0rpx 64rpx 0rpx 48rpx;
}
.text-block {
overflow: hidden;
height: 96rpx;
......@@ -284,6 +384,10 @@
color: #888;
}
.planout-block-item {
/* margin: 32rpx 0; */
}
.picker-year {
position: relative;
border-radius: 4px;
......@@ -293,10 +397,14 @@
.uni-list-cell {
flex: 1;
height: 96rpx;
line-height: 96rpx;
align-items: center;
}
.uni-list-cell-db {
flex: 1;
align-items: center;
}
.picker-block {
......@@ -304,26 +412,45 @@
}
.uni-input-text {
height: 96rpx;
line-height: 96rpx;
font-size: 14px;
color: #888;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.icon-arrow {
position: absolute;
right: 0;
top: 16px;
width: 12rpx;
height: 20rpx;
z-index: 10;
}
.planout-block-lists {
.planout-block {
display: flex;
flex-direction: column;
justify-content: space-between;
margin-top: 30rpx;
margin-bottom: 30rpx;
padding: 0 24rpx;
}
.planout-block-item {
margin-bottom: 32rpx;
.btn {
flex: 1;
height: 92rpx;
background: $wly-primary-color;
border-radius: 46rpx;
}
.btn-text {
color: #fff;
font-size: 34rpx;
}
.scroll-area {
overflow-y: scroll;
}
.scroll-item {
......@@ -375,28 +502,6 @@
color: #333;
}
.detal-item-label {
color: #999;
font-size: 24rpx;
}
.detal-item-value {
color: #333;
font-size: 28rpx;
}
.btn {
flex: 1;
height: 92rpx;
background: $wly-primary-color;
border-radius: 46rpx;
}
.btn-text {
color: #fff;
font-size: 34rpx;
}
.loading-more {
flex: 1;
align-items: center;
......
......@@ -35,6 +35,10 @@ export async function findByCustomer(params) {
const res = await apiHelper.get('/crm-app/setShunting/findByCustomer', params, {'Content-Type': 'application/json'})
return res
}
export async function findByCustomerWithFilter(params) {
const res = await apiHelper.post('/crm-app/setShunting/findByCustomerWithFilter', params, {'Content-Type': 'application/json'})
return res
}
export async function findAppGoodsSingle(params) {
const res = await apiHelper.post('/crm-app/wantgoods/findAppGoodsSingle', params)
return res
......
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