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

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

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