123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233 |
- // StepPage/pages/lin/lin.js
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- productList:[
- {roll_film_id:'',basic_roll_film_id:'',b_r_f_name:'',title:'',code:'',apply_number:'',mark:''}
- ],
- basicRollFilmList:[],
- show:false,
- searchValue:'',
- searchList:[],
- chooseIndex:'',
- rollFilmList:[],
- sureRollFilmList:[],
- set_status:''
- },
- handleReturn(){
- wx.redirectTo({
- url: '../lin/lin',
- })
- },
- handleChangeNumber(e){
- let arr = this.data.productList;
- let index = e.target.dataset.index;
- arr[index].take_number = e.detail;
- this.setData({
- productList:arr
- })
- },
- onChangeMark(e){
- let arr = this.data.productList;
- let index = e.target.dataset.index;
- arr[index].mark = e.detail;
- this.setData({
- productList:arr
- })
- },
- handleNext(){
- const app = getApp();
- const openid = app.globalData.openID;
- let data = {
- apply:{
- apply_sub:this.data.productList,
- area:app.globalData.area
- },
- company_id:app.globalData.company_id,
- four_shop_id:app.globalData.fourShopId,
- regional_manager:app.globalData.regional_manager,
- storehouse_id:app.globalData.storehouse_id,
- contract_phone:app.globalData.contract_phone,
- take_person:app.globalData.take_person,
- take:{
- take:app.globalData.take_person,
- take_sub:this.data.productList
- },
- take_address:app.globalData.take_address,
- take_phone:app.globalData.take_phone,
- is_cash:app.globalData.is_cash,
- is_give:app.globalData.is_give,
- }
- data.order_number = app.globalData.detailData.order_number
- wx.p.request({
- url: `${app.globalData.url}wx/materialOrderEdit`,
- method:'POST',
- data:{
- openid,
- ...data
- }
- }).then(res=>{
- if(res.data.code==200){
- wx.showToast({
- title: '保存成功!',
- })
- app.globalData={
- stepData:[],
- openID:app.globalData.openID,
- url:'https://zhapi.qingyaokeji.com/'
- }
- wx.redirectTo({
- url: '../report/LinList/LinList',
- })
- }else{
- wx.showToast({
- icon:'error',
- title: '保存失败!',
- })
- }
- })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- const app = getApp();
- const openid = app.globalData.openID;
- const storehouse_id = app.globalData.storehouse_id;
- const company_id = app.globalData.company_id;
- //获取卷膜分类
- wx.p.request({
- url: `${app.globalData.url}wx/basicRollFilmList`,
- method:'POST',
- data:{
- openid
- }
- }).then(res=>{
- if(res.data.code==200){
- this.setData({
- basicRollFilmList:this.getArr(res.data.data)
- })
- }
- })
- //获取卷膜型号
- wx.p.request({
- url: `${app.globalData.url}wx/rollFilmList`,
- method:'POST',
- data:{
- use:1,
- openid,
- storehouse_id,
- company_id
- }
- }).then(res=>{
- if(res.data.code==200){
- this.setData({
- rollFilmList:res.data.data.data,
- sureRollFilmList:JSON.parse(JSON.stringify(res.data.data.data))
- })
- }
- })
- if(app.globalData.set_status){
- if(app.globalData.set_status=='is_detail'){
- this.setData({
- productList:app.globalData.detailData.take.take_sub,
- set_status:app.globalData.set_status
- })
- }else{
- if(app.globalData.detailData.apply_status!=0){
- this.setData({
- productList:app.globalData.detailData.take.take_sub,
- set_status:app.globalData.set_status
- })
- }else{
- console.log(123)
- let arr = JSON.parse(JSON.stringify(app.globalData.apply_sub));
- arr.forEach(v=>{
- v.send_number = v.apply_number;
- v.take_number = v.apply_number;
- })
- this.setData({
- productList:arr,
- set_status:app.globalData.set_status
- })
- }
- }
- }else{
- this.setData({
- set_status:''
- })
- }
- },
- getArr(arr){
- let data = [];
- arr.forEach(v=>{
- if(v.children.length==0){
- data.push(v);
- }else{
- data = [...data,...this.getArr(v.children)]
- }
- })
- return data;
- },
- handleBack(){
- let app = getApp()
- app.globalData={
- stepData:[],
- openID:app.globalData.openID,
- url:'https://zhapi.qingyaokeji.com/'
- }
- wx.redirectTo({
- url: '../report/LinList/LinList',
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|