const app = getApp<IAppOption>();
|
Page({
|
data: {
|
selectedSellerIdList:[],
|
selectedSellerList:[] as any,
|
sellerList:[
|
{DocItem: 10, SellerId: 111, SellerName: "好几十", Telephone: "15555555555", isDefaultSellerName: false},
|
{DocItem: 10, SellerId: 222, SellerName: "好", Telephone: "15588885555", isDefaultSellerName: false},
|
{DocItem: 10, SellerId: 333, SellerName: "555", Telephone: "18888555555", isDefaultSellerName: false},
|
{DocItem: 10, SellerId: 444, SellerName: "666", Telephone: "18333333333", isDefaultSellerName: false},
|
{DocItem: 10, SellerId: 555, SellerName: "777", Telephone: "18666666666", isDefaultSellerName: false},
|
]
|
},
|
onLoad() {
|
console.log(app);
|
// this.getSellerList();
|
const eventChannel = this.getOpenerEventChannel();
|
eventChannel.on('getSellerListFromPromotionsPage', (data:any)=> {
|
console.log('获取新建活动时选中的营销人员',data)
|
this.setData({
|
selectedSellerIdList:data.selectedSellerIdList,
|
})
|
|
})
|
},
|
// handleSelectedSellerList(list:[]){
|
// let {sellerList, selectedSellerIdList} = this.data;
|
// selectedSellerIdList.forEach((id)=>{
|
// sellerList.forEach((item)=>{
|
// if (item.SellerId == id) {
|
//
|
// }
|
// })
|
// })
|
// },
|
|
getSelectedSellerList(){
|
let {sellerList, selectedSellerIdList,selectedSellerList} = this.data;
|
selectedSellerIdList.forEach((id)=>{
|
sellerList.forEach((item)=>{
|
if (item.SellerId == Number(id)) {
|
selectedSellerList.push(item)
|
}
|
})
|
})
|
return selectedSellerList;
|
},
|
selectSeller(event:any) {
|
console.log(event)
|
this.setData({
|
selectedSellerIdList: event.detail
|
});
|
},
|
toggle(event:any) {
|
const { index } = event.currentTarget.dataset;
|
const checkbox = this.selectComponent(`.checkboxes-${index}`);
|
checkbox.toggle();
|
console.log(index);
|
},
|
toggle2(event:any){
|
console.log(event);
|
},
|
goSellerEdit(event:any){
|
let id = event.currentTarget.dataset.id;
|
wx.navigateTo({
|
url:`../sellerEdit/sellerEdit?id=${id}`
|
})
|
},
|
|
onSubmit(){
|
let {selectedSellerIdList} = this.data;
|
let selectedSellerList = this.getSelectedSellerList();
|
console.log('选中的营销人员id与列表',selectedSellerIdList,selectedSellerList);
|
let eventChannel = this.getOpenerEventChannel();
|
eventChannel.emit('getSelectedSellerList', {
|
selectedSellerIdList,
|
selectedSellerList
|
});
|
wx.navigateBack();
|
},
|
|
async getSellerList() {
|
let [error, result] = await wx.$utils.to(
|
wx.$http.request({
|
url:`/shopping/panicBuying.do?m=getMyVisiteTraceList`,
|
})
|
)
|
if (error){
|
console.log(error);
|
return;
|
}
|
console.log(result);
|
}
|
})
|
export {}
|