Commit 074fb524 by zhangxw

选择门店 添加搜索 超管登录拿所有4s店

1 parent aed5b7e6
// packageEquity/components/storePicker/storePicker.js
Component({
options: {
// 在组件定义时的选项中启用多slot支持
multipleSlots: true
},
/**
* 组件的属性列表
*/
properties: {
items: {
type: Array,
value: [],
observer: function (n) {
if (n) {
let userInfo = wx.$util.getUserInfo()
let defaultSelectStoreIndex = n?.findIndex(v => {return v.merchantId == userInfo?.default4SStoreInfo?.merchantId}) > -1 ? n?.findIndex(v => {return v.merchantId == userInfo?.default4SStoreInfo?.merchantId}) : 0
this.setData({defaultSelectStoreIndex: [defaultSelectStoreIndex], selectStoreIndex: defaultSelectStoreIndex})
}
}
},
show: {
type: Boolean,
}
},
/**
* 组件的初始数据
*/
data: {
searchValue:'',
selectStoreIndex:'',
edit: false,
defaultSelectStoreIndex: []
},
/**
* 组件的方法列表
*/
methods: {
open() {
if (this.data.disabled) return
this.setData({
edit: true,
inputFocus: true
})
},
setValue(value) {
if (this.properties.filterEmoji) {
if (wx.$util.haveEmoji(value)) value = wx.$util.replaceEmoji(value)
}
this.setData({
searchValue: value
})
},
input(e) {
let {
value
} = e.detail
this.setValue(value)
this.triggerEvent('input', {
value
})
},
inputBlur(e) {
this.emit(e)
},
inputConfifm(e) {
this.emit(e)
},
emit(e) {
let {
detail:{
value
},
type
} = e
this.setData({
edit: false
})
this.setValue(value)
this.triggerEvent(type == 'confirm' ? 'search' : 'blur', {value})
},
confirm() {
let {selectStoreIndex, items } = this.data
if (!items.length) {
return wx.$util.showToast('请选择门店')
}
this.triggerEvent('confirm', selectStoreIndex)
this.setData({
show: false
})
},
changeStore(e) {
console.log(e)
this.setData({
selectStoreIndex: e.detail.value
})
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--packageEquity/components/storePicker/storePicker.wxml-->
<popup class="date-background" show="{{show}}" bindconfirm="confirm" height="45%">
<view class='date-container'>
<view class='date-confirm'>
<view class="search-box">
<view class="search-input">
<block wx:if="{{!edit}}">
<view class="input {{searchValue?'':'placeholder'}}" bindtap="open">
<block wx:if="{{searchValue}}">
{{searchValue}}
</block>
<block wx:else>
<image src="../../../images/search.png" class="icon"></image>
{{'请输入门店'}}
</block>
</view>
</block>
<block wx:else>
<input type="text" class="input" value='{{searchValue}}' focus='{{inputFocus}}' confirm-type="search" bindinput='input' bindblur="inputBlur" bindconfirm="inputConfifm"/>
</block>
</view>
</view>
</view>
<view class="picker-box">
<picker-view class="picker" value="{{defaultSelectStoreIndex}}" indicator-class="indicator" bindchange="changeStore" bindpickend="dateDone">
<picker-view-column>
<block wx:for="{{items}}" wx:key="merchantId">
<view class="view pickViewColumn">{{item.merchantName}}</view>
</block>
</picker-view-column>
</picker-view>
</view>
</view>
</popup>
/* packageEquity/components/storePicker/storePicker.wxss */
.search-box {
height: 104rpx;
display: flex;
align-items: center;
justify-content: center;
margin: 0 32rpx;
font-size: 28rpx;
}
.search-box .search-input {
width: 686rpx;
height: 72rpx;
background: #F7F8FA;
border-radius: 38rpx;
color: #333;
}
.search-input .input{
display: flex;
align-items: center;
justify-content: center;
height: 100%;
width: 100%;
text-align: center;
}
.search-input .icon{
width: 28rpx;
height: 28rpx;
margin-right: 10rpx;
}
.search-input .placeholder{
color: #C8C9CC;
}
.date-confirm {
display: flex;
justify-content: center;
align-items: center;
padding:0 20rpx;
font-size:34rpx;
line-height: 70rpx;
}
.picker-box{
height: 450rpx;
display: flex;
}
.picker-box .picker{
width: 100%;
}
.tbn_class{
font-size: 26rpx;
color: #333;
}
.pickViewColumn{
text-align: center;
line-height: 34px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
\ No newline at end of file
......@@ -18,21 +18,36 @@ Page({
tabIndex: 0,
pageShow: [true, false],
navBarHeight: 0,
subIndex: 0
showPicker: false,
userInfo: {},
selectStroeIndex: 0
},
init(userInfo) {
// 获取园区店下的4s店数据
get4SStoreList({yqMerchantId: userInfo?.merchantId}).then(result => {
let { subIndex } = this.data
subIndex = userInfo?.default4SStoreInfo?.merchantId ? result?.findIndex(v => {return v.merchantId == userInfo?.default4SStoreInfo?.merchantId}) : 0
this.setData({userInfo})
this.getStoreList()
},
getStoreList(e) {
// 获取园区店下的4s店数据 超管拉全部数据
let { userInfo } = this.data
get4SStoreList({yqMerchantId: userInfo?.isSuper ? '' : userInfo?.merchantId, merchantName: e?.detail.value}).then(result => {
userInfo = wx.$util.getUserInfo()
let selectStroeIndex = result?.findIndex(v => {return v.merchantId == userInfo?.default4SStoreInfo?.merchantId}) > -1 ? result?.findIndex(v => {return v.merchantId == userInfo?.default4SStoreInfo?.merchantId}) : 0
this.setData({
storeListRange: result,
subIndex
userInfo,
selectStroeIndex
})
}).catch(err => {})
},
showStorePicker() {
this.setData({
showPicker: true,
})
},
changeTabBar(e) {
let {
pageShow
......@@ -60,21 +75,14 @@ Page({
},
changePicker(e) {
let { value } = e.detail
let { storeListRange, subIndex } = this.data
let { storeListRange, selectStroeIndex } = this.data
let value = e.detail || selectStroeIndex
let default4SStoreInfo = storeListRange[value]
subIndex = value
this.setData({
subIndex
})
wx.$util.setUserInfo({...wx.$util.getUserInfo(), default4SStoreInfo})
this.selectComponent('#page-0').onLoad && this.selectComponent('#page-0').onLoad()
this.selectComponent('#page-1').onLoad && this.selectComponent('#page-1').onLoad()
this.tapPicker()
},
tapPicker() {
this.setData({
moveArrow: !this.data.moveArrow
userInfo: {...wx.$util.getUserInfo(), default4SStoreInfo}
})
},
back() {
......
......@@ -2,7 +2,8 @@
"usingComponents": {
"custom-tabBar": "/components/CustomTabBar/CustomTabBar",
"quotation-list": "../carQuotation/index/index",
"equity-list": "../carEquity/components/EquityList/EquityList"
"equity-list": "../carEquity/components/EquityList/EquityList",
"store-picker": "../../components/storePicker/storePicker"
},
"navigationStyle": "custom"
}
<!-- pages/equity/index.wxml -->
<navigation-bar class="navigation-header" bindnavbarReady="navbarReady" showMenu="{{true}}" bindback="back">
<picker range="{{storeListRange}}" value="{{subIndex}}" range-key="merchantName" bindchange="changePicker" bindtap="tapPicker" bindcancel="tapPicker" disabled="{{storeListRange.length < 2}}">
<view class="navigation-title">
<view class="navigation-title-text text-hide">{{storeListRange[subIndex].merchantName}}</view>
<view class="arrow {{moveArrow?'move':''}}" wx:if="{{storeListRange.length > 1}}">
<image src="/images/back.png" />
</view>
<view class="navigation-title" bindtap="showStorePicker">
<view class="navigation-title-text text-hide">{{userInfo && userInfo.default4SStoreInfo && userInfo.default4SStoreInfo.merchantName}}</view>
<view class="arrow">
<image src="/images/back.png" />
</view>
</picker>
</view>
</navigation-bar>
<!-- style="margin-top:{{navBarHeight}}px" -->
<view class="layout" style="padding-top:{{navBarHeight}}px; height: calc(100vh - {{navBarHeight}}px);">
......@@ -16,4 +14,5 @@
<equity-list id="page-1" navBarHeight="{{navBarHeight}}" class="{{tabIndex == 1?'':'hide'}}" />
</block>
</view>
<custom-tabBar list="{{tabBarList}}" color="#6C6C70" selectedColor="#3582EE" tabIndex="{{tabIndex}}" bindchange="changeTabBar" />
\ No newline at end of file
<custom-tabBar list="{{tabBarList}}" color="#6C6C70" selectedColor="#3582EE" tabIndex="{{tabIndex}}" bindchange="changeTabBar" />
<store-picker items="{{storeListRange}}" show="{{showPicker}}" bindsearch="getStoreList" bindconfirm="changePicker"></store-picker>
\ No newline at end of file
......@@ -180,7 +180,7 @@ Page({
if (code == 0) {
let openSceneArr = []
data?.forEach(v => {
if (v.sceneOpenFlag === 1) openSceneArr.push(v.scene)
if (v.sceneOpenFlag === 0) openSceneArr.push(v.scene)
})
if (!openSceneArr.length) {
wx.$util.showToast('暂无开通场景')
......
......@@ -212,7 +212,8 @@ export const get4SStoreList = options => {
api
.getSceneMerchantRefStoreList({
merchantId: options.yqMerchantId,
scene: 0
scene: 0,
merchantName: options.merchantName
})
.then(res => {
let { code, data } = res
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!