Commit fe00bb0c by 张立顺

2.1 报价单 推荐模糊功能开发

1 parent e18f4fdd
...@@ -52,19 +52,8 @@ Component({ ...@@ -52,19 +52,8 @@ Component({
employeeList: [], employeeList: [],
first: data.firstObj, first: data.firstObj,
disable: true, disable: true,
// salesList: [
// {
// id: '1',
// name: 'CCC'
// },
// {
// id: '2',
// name: 'AAA'
// }
// ],
formRule: data.formRule, formRule: data.formRule,
// 品牌车型 referrerPicker: true,
// brandBox: false,
textNameObj: { textNameObj: {
confirmName: '下一步(1/4)', confirmName: '下一步(1/4)',
cancelName: '存草稿' cancelName: '存草稿'
...@@ -89,17 +78,14 @@ Component({ ...@@ -89,17 +78,14 @@ Component({
// 'formData.referrer': this.data.employeeList[idx].staffName // 'formData.referrer': this.data.employeeList[idx].staffName
// }) // })
// }, // },
handleReferrerPicker() {
this.setData({
referrerPicker: true
})
},
handleSalesChange(e) { handleSalesChange(e) {
// let value = e.detail // let value = e.detail
console.log(e) console.log(e)
// let { attrname, attrtype } = e.target.dataset
// let { } = this.data
// let thisPage = wx.$router.getPageInstance()
// ['orderInfo' + '.' + attrType]
// console.log(['orderInfo' + '.' + attrType], '2')
// thisPage.setData({
// ['orderInfo' + '.' + attrtype + '.' + attrname]: value
// })
let idx = e.detail.value || 0 let idx = e.detail.value || 0
let { employeeList, disable } = this.data let { employeeList, disable } = this.data
if (disable) return false if (disable) return false
...@@ -109,13 +95,6 @@ Component({ ...@@ -109,13 +95,6 @@ Component({
['orderInfo.referrerId']: employeeList[idx].uuid, ['orderInfo.referrerId']: employeeList[idx].uuid,
['orderInfo.referrer']: employeeList[idx].staffName ['orderInfo.referrer']: employeeList[idx].staffName
}) })
// ['orderInfo' + '.' + attrType]
// console.log(['orderInfo' + '.' + attrType], '2')
// this.setData({
// 'formData.actualSalesPersonId': this.data.employeeList[idx].uuid,
// 'formData.actualSalesPerson': this.data.employeeList[idx].staffName
// })
// console.log(thisPage.data)
}, },
// 获取推荐人列表 // 获取推荐人列表
getEmployee() { getEmployee() {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
"component": true, "component": true,
"usingComponents": { "usingComponents": {
"gl-form": "/packageEquity/components/GLForm/GLForm", "gl-form": "/packageEquity/components/GLForm/GLForm",
"Gl-Button-Group": "../../../../components/GlButtonGroup/GlButtonGroup" "Gl-Button-Group": "../../../../components/GlButtonGroup/GlButtonGroup",
"store-referrer-picker": "../storeReferrerPicker/storeReferrerPicker"
} }
} }
...@@ -7,17 +7,17 @@ ...@@ -7,17 +7,17 @@
label="推荐人" label="推荐人"
class="pickerCell" class="pickerCell"
labelWidth="{{defaultLabelWidth}}"> labelWidth="{{defaultLabelWidth}}">
<picker <!-- <picker
bindchange="handleSalesChange" bindchange="handleSalesChange"
value="{{index}}" value="{{index}}"
range="{{employeeList}}" range="{{employeeList}}"
range-key="staffName"> range-key="staffName"> -->
<view class="picker"> <view class="picker" bindtap="handleReferrerPicker">
<image class="pickerArrow" src="/components/images/arrow-x.png" /> <image class="pickerArrow" src="/components/images/arrow-x.png" />
<view class="text-hide" wx:if="{{orderInfo.referrerId }}">{{orderInfo.referrer }}</view> <view class="text-hide" wx:if="{{orderInfo.referrerId }}">{{orderInfo.referrer }}</view>
<text class="placeholder" wx:else>请选择</text> <text class="placeholder" wx:else>请选择</text>
</view> </view>
</picker> <!-- </picker> -->
</gl-cell> </gl-cell>
</view> </view>
<view class="box"> <view class="box">
...@@ -63,4 +63,9 @@ ...@@ -63,4 +63,9 @@
</view> </view>
<Gl-Button-Group bindbtnTap="btnTap" textNameObj="{{textNameObj}}" /> <Gl-Button-Group bindbtnTap="btnTap" textNameObj="{{textNameObj}}" />
</view> </view>
<store-referrer-picker
bindconfirm="handleSalesChange"
show="{{referrerPicker}}"
referrerId="{{orderInfo.referrerId}}"
pickerListAll="{{employeeList}}" />
// packageEquity/components/storePicker/storePicker.js
Component({
options: {
// 在组件定义时的选项中启用多slot支持
multipleSlots: true
},
/**
* 组件的属性列表
*/
properties: {
pickerListAll: {
type: Array,
value: [],
observer: function (n) {
if (n) {
this.init()
}
}
},
referrerId: {
type: String,
value: '',
observer: function (n) {
if (n) {
let { pickerList } = this.data
let defaultSelectStoreIndex = pickerList?.findIndex(v => {
return v.uuid == n
})
this.setData({ defaultSelectStoreIndex: [defaultSelectStoreIndex], selectStoreIndex: defaultSelectStoreIndex })
}
}
},
show: {
type: Boolean
}
},
/**
* 组件的初始数据
*/
data: {
searchValue: '',
selectStoreIndex: 0,
edit: false,
pickerList: [],
defaultSelectStoreIndex: []
},
/**
* 组件的方法列表
*/
methods: {
init() {
let { pickerListAll } = this.properties
this.setData({
pickerList: wx.$util.deepClone(pickerListAll)
})
},
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
let { pickerListAll } = this.data
this.setValue(value)
if (value) {
const pickerList = pickerListAll.filter(v => {
return v.staffName.includes(value)
})
this.setData({
pickerList
})
} else {
this.init()
}
this.setData({
selectStoreIndex: 0,
defaultSelectStoreIndex: [0]
})
},
inputBlur(e) {
this.emit(e)
},
inputConfifm(e) {
this.emit(e)
},
emit(e) {
let {
detail: { value },
type
} = e
this.setData({
edit: false
})
this.setValue(value)
// console.log('123')
this.triggerEvent(type == 'confirm' ? 'search' : 'blur', { value })
},
confirm() {
let { selectStoreIndex, pickerListAll, pickerList } = this.data
const referrerItem = pickerList[selectStoreIndex]
const pickerIndex = pickerListAll.findIndex(v => {
return v.uuid == referrerItem.uuid
})
// console.log(referrerItem)
// console.log(pickerIndex)
// return
if (pickerIndex == -1) return wx.$util.showToast('请选择员工')
this.triggerEvent('confirm', { value: pickerIndex })
this.setData({
show: false
})
},
changeStore(e) {
this.setData({
selectStoreIndex: e.detail.value[0]
})
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file \ No newline at end of file
<popup
class="date-background"
show="{{show}}"
bindconfirm="confirm"
height="800rpx">
<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" />
{{'请输入名字'}}
</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}}"
immediate-change="true"
indicator-class="indicator"
bindchange="changeStore">
<picker-view-column>
<block wx:for="{{pickerList}}" wx:key="merchantId">
<view class="view pickViewColumn">{{item.staffName}}</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 \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!