| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- // StepPage/pages/diao/diao.js
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- searchValue:'',
- show:false,
- searchList:[],
- searchValue_in:'',
- show_in:false,
- searchListIn:[],
- searchValue_out:'',
- show_out:false,
- searchListOut:[],
- company_id:"",
- company_name:'',
- out_title:'',
- in_title:'',
- storehouseList:[],
- from_storehouse_id:'',
- to_storehouse_id:'',
- mark:'',
- set_status:''
- },
- handleClick(){
- this.setData({
- show:true,
- searchList:this.data.companyList
- })
- },
- handleChoose(item){
- this.setData({
- show:false,
- company_id:item.target.dataset.item.id,
- company_name:item.target.dataset.item.title,
- in_title:'',
- out_title:'',
- to_storehouse_id:'',
- from_storehouse_id:''
- })
- },
- onSearch(event){
- let arr = this.data.companyList.filter(v=>v.title.indexOf(event.detail)!=-1);
- this.setData({
- searchList:arr
- })
- },
- handleCancel(){
- this.setData({
- show:false
- })
- },
- handleClickIn(){
- let app = getApp();
- let openid = app.globalData.openID;
- let id = this.data.company_id;
- wx.p.request({
- url: `${app.globalData.url}wx/companyAndStoreHouse`,
- method:'POST',
- data:{
- openid,
- id
- }
- }).then(res=>{
- this.setData({
- show_in:true,
- storehouseList:res.data.data,
- searchListIn:res.data.data
- })
- })
- },
- handleChooseIn(item){
- this.setData({
- show_in:false,
- to_storehouse_id:item.target.dataset.item.id,
- in_title:item.target.dataset.item.title
- })
- },
- onSearchIn(event){
- let arr = this.data.storehouseList.filter(v=>v.title.indexOf(event.detail)!=-1);
- console.log(arr)
- this.setData({
- searchListIn:arr
- })
- },
- handleCancelIn(){
- this.setData({
- show_in:false
- })
- },
- handleClickOut(){
- let app = getApp();
- let openid = app.globalData.openID;
- let id = this.data.company_id;
- wx.p.request({
- url: `${app.globalData.url}wx/companyAndStoreHouse`,
- method:'POST',
- data:{
- openid,
- id
- }
- }).then(res=>{
- this.setData({
- show_out:true,
- storehouseList:res.data.data,
- searchListOut:res.data.data
- })
- })
- },
- handleChooseOut(item){
- this.setData({
- show_out:false,
- from_storehouse_id:item.target.dataset.item.id,
- out_title:item.target.dataset.item.title
- })
- },
- onSearchOut(event){
- let arr = this.data.storehouseList.filter(v=>v.title.indexOf(event.detail)!=-1);
- this.setData({
- searchListOut:arr
- })
- },
- handleCancelOut(){
- this.setData({
- show_out:false
- })
- },
- handleChangeremark(e){
- this.setData({
- mark:e.detail.value
- })
- },
- handleReturn(){
- wx.navigateBack({
- delta:1
- })
- },
- handleNext(){
- if(this.data.company_id&&this.data.to_storehouse_id&&this.data.from_storehouse_id){
- let app = getApp();
- app.globalData.company_id = this.data.company_id;
- app.globalData.to_storehouse_id = this.data.to_storehouse_id;
- app.globalData.from_storehouse_id = this.data.from_storehouse_id;
- app.globalData.storehouse_id = this.data.from_storehouse_id;
- app.globalData.mark = this.data.mark;
- wx.navigateTo({
- url: '../diaoNext/diaoNext',
- })
- }else{
- return wx.showToast({
- icon:'none',
- title: '请填写必填信息',
- })
- }
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- let app = getApp();
- let openid = app.globalData.openID;
- // 获取集团
- wx.p.request({
- url: `${app.globalData.url}wx/companyList`,
- method:'POST',
- data:{
- openid
- }
- }).then(res=>{
- this.setData({
- companyList:res.data.data.data
- })
- })
- if(app.globalData.set_status){
- this.setData({
- set_status:app.globalData.set_status,
- company_name:app.globalData.detailData.company_name,
- company_id:app.globalData.detailData.company_id,
- in_title:app.globalData.detailData.to_storehouse_name,
- out_title:app.globalData.detailData.from_storehouse_name,
- mark:app.globalData.detailData.mark,
- to_storehouse_id:app.globalData.detailData.to_storehouse_id,
- from_storehouse_id:app.globalData.detailData.from_storehouse_id,
- })
- }else{
- this.setData({
- set_status:''
- })
- }
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|