zs 3 年 前
コミット
a527e17245

+ 30 - 4
pages/indepot/detail.js

@@ -11,6 +11,7 @@ Page({
         frameStyle: { useTop: true, name: '信息管理', leftArrow: true, useBar: false },
         // 主体高度
         infoHeight: '',
+        id:'',
         form: {},
         // 弹框
         dialog: { title: '添加商品', show: false, type: '1' },
@@ -107,11 +108,11 @@ Page({
     onSubmit: function (e) {
         const params = e.detail.value;
         if (!this.WxValidate.checkForm(params)) {
-          const error = this.WxValidate.errorList[0];
-          wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
-          return false
+            const error = this.WxValidate.errorList[0];
+            wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
+            return false
         } else {
-          console.log(params);
+            console.log(params);
         }
     },
     /**
@@ -122,9 +123,34 @@ Page({
         this.searchOther();
         //验证规则函数
         this.initValidate()
+        if (options.id) this.setData({ id: options.id })
+        // 监听用户是否登录
+        this.watchLogin();
         // 计算高度
         this.searchHeight()
     },
+    // 监听用户是否登录
+    watchLogin: function () {
+        const that = this;
+        let id = that.data.id;
+        if (id) {
+            // 如果有ID查询数据详情,赋值给form
+        }
+        // wx.getStorage({
+        // key: 'user',
+        // success: res => {
+        //   if (res.data) {
+        //     // 查询菜单
+        //     if (res.data) this.searchRouter(res.data);
+        //     res.data.type = type.find((i) => i.value == res.data.type).label;
+        //     if (res.data) this.setData({ userInfo: res.data });
+        //     if (res.data && res.data.avatarUrl) this.setData({ avatarUrl: res.data.avatarUrl });
+        //   } else {
+        //     wx.redirectTo({ url: '/pages/login/index', })
+        //   }
+        // }
+        // })
+    },
     // 查询其他信息
     searchOther: function () {
     },

+ 24 - 5
pages/indepot/index.js

@@ -10,11 +10,11 @@ Page({
         // 主体高度
         infoHeight: '',
         // 采购申请
-        list: [{ id: '1234567', register_name: '登记人', register_phone: '登记人电话', register_date: '2022-5-16' }],
+        list: [],
         // 弹框
         dialog: { title: '详细信息', show: false, type: '1' },
         // 详细信息
-        info: { id: '1234567', register_name: '登记人', register_phone: '登记人电话', register_date: '2022-5-16', reason: '无', order: [{ name: '商品1', num: '10' }] },
+        info: {},
     },
     back: function () {
         wx.navigateBack({ url: '/pages/home/index' })
@@ -25,18 +25,37 @@ Page({
     },
     // 详细信息
     toView: function (e) {
+        let data = { id: '1234567', register_name: '登记人', register_phone: '登记人电话', register_date: '2022-5-16', reason: '无', order: [{ name: '商品1', num: '10' }] }
+        this.setData({ info: data })
         this.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
     },
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
-        this.search();
+        // 监听用户是否登录
+        this.watchLogin();
         // 计算高度
         this.searchHeight();
     },
-    search: function () {
-        console.log("查询");
+    // 监听用户是否登录
+    watchLogin: function () {
+        let data = [{ id: '1234567', register_name: '登记人', register_phone: '登记人电话', register_date: '2022-5-16' }]
+        this.setData({ list: data })
+        // wx.getStorage({
+        // key: 'user',
+        // success: res => {
+        //   if (res.data) {
+        //     // 查询菜单
+        //     if (res.data) this.searchRouter(res.data);
+        //     res.data.type = type.find((i) => i.value == res.data.type).label;
+        //     if (res.data) this.setData({ userInfo: res.data });
+        //     if (res.data && res.data.avatarUrl) this.setData({ avatarUrl: res.data.avatarUrl });
+        //   } else {
+        //     wx.redirectTo({ url: '/pages/login/index', })
+        //   }
+        // }
+        // })
     },
     // 计算高度
     searchHeight: function () {

+ 26 - 0
pages/outdepot/detail.js

@@ -10,6 +10,7 @@ Page({
     frameStyle: { useTop: true, name: '信息管理', leftArrow: true, useBar: false },
     // 主体高度
     infoHeight: '',
+    id: '',
     form: {},
     // 弹框
     dialog: { title: '添加商品', show: false, type: '1' },
@@ -86,9 +87,34 @@ Page({
   onLoad: function (options) {
     //验证规则函数
     this.initValidate()
+    if (options.id) this.setData({ id: options.id })
+    // 监听用户是否登录
+    this.watchLogin();
     // 计算高度
     this.searchHeight()
   },
+  // 监听用户是否登录
+  watchLogin: function () {
+    const that = this;
+    let id = that.data.id;
+    if (id) {
+      // 如果有ID查询数据详情,赋值给form
+    }
+    // wx.getStorage({
+    // key: 'user',
+    // success: res => {
+    //   if (res.data) {
+    //     // 查询菜单
+    //     if (res.data) this.searchRouter(res.data);
+    //     res.data.type = type.find((i) => i.value == res.data.type).label;
+    //     if (res.data) this.setData({ userInfo: res.data });
+    //     if (res.data && res.data.avatarUrl) this.setData({ avatarUrl: res.data.avatarUrl });
+    //   } else {
+    //     wx.redirectTo({ url: '/pages/login/index', })
+    //   }
+    // }
+    // })
+  },
   // 计算高度
   searchHeight: function () {
     let frameStyle = this.data.frameStyle;

+ 24 - 5
pages/outdepot/index.js

@@ -10,11 +10,11 @@ Page({
         // 主体高度
         infoHeight: '',
         // 采购申请
-        list: [{ id: '1234567', register_name: '登记人', register_phone: '登记人电话', register_date: '2022-5-16' }],
+        list: [],
         // 弹框
         dialog: { title: '详细信息', show: false, type: '1' },
         // 详细信息
-        info: { id: '1234567', register_name: '登记人', register_phone: '登记人电话', register_date: '2022-5-16', reason: '无', order: [{ name: '商品1', num: '10' }] },
+        info: {},
     },
     back: function () {
         wx.navigateBack({ url: '/pages/home/index' })
@@ -25,18 +25,37 @@ Page({
     },
     // 详细信息
     toView: function (e) {
+        let data = { id: '1234567', register_name: '登记人', register_phone: '登记人电话', register_date: '2022-5-16', reason: '无', order: [{ name: '商品1', num: '10' }] }
+        this.setData({ info: data })
         this.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
     },
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
-        this.search();
+        // 监听用户是否登录
+        this.watchLogin();
         // 计算高度
         this.searchHeight();
     },
-    search: function () {
-        console.log("查询");
+    // 监听用户是否登录
+    watchLogin: function () {
+        let data = [{ id: '1234567', register_name: '登记人', register_phone: '登记人电话', register_date: '2022-5-16' }]
+        this.setData({ list: data })
+        // wx.getStorage({
+        // key: 'user',
+        // success: res => {
+        //   if (res.data) {
+        //     // 查询菜单
+        //     if (res.data) this.searchRouter(res.data);
+        //     res.data.type = type.find((i) => i.value == res.data.type).label;
+        //     if (res.data) this.setData({ userInfo: res.data });
+        //     if (res.data && res.data.avatarUrl) this.setData({ avatarUrl: res.data.avatarUrl });
+        //   } else {
+        //     wx.redirectTo({ url: '/pages/login/index', })
+        //   }
+        // }
+        // })
     },
     // 计算高度
     searchHeight: function () {

+ 26 - 0
pages/stock/detail.js

@@ -13,6 +13,7 @@ Page({
         infoHeight: '',
         // 类型
         typeList: [],
+        id: '',
         form: {},
         stock_type: '',
         // 图片
@@ -78,9 +79,34 @@ Page({
         this.searchOther()
         //验证规则函数
         this.initValidate()
+        if (options.id) this.setData({ id: options.id })
+        // 监听用户是否登录
+        this.watchLogin();
         // 计算高度
         this.searchHeight()
     },
+    // 监听用户是否登录
+    watchLogin: function () {
+        const that = this;
+        let id = that.data.id;
+        if (id) {
+            // 如果有ID查询数据详情,赋值给form
+        }
+        // wx.getStorage({
+        // key: 'user',
+        // success: res => {
+        //   if (res.data) {
+        //     // 查询菜单
+        //     if (res.data) this.searchRouter(res.data);
+        //     res.data.type = type.find((i) => i.value == res.data.type).label;
+        //     if (res.data) this.setData({ userInfo: res.data });
+        //     if (res.data && res.data.avatarUrl) this.setData({ avatarUrl: res.data.avatarUrl });
+        //   } else {
+        //     wx.redirectTo({ url: '/pages/login/index', })
+        //   }
+        // }
+        // })
+    },
     // 查询其他信息
     searchOther: function () {
         //查询类型

+ 25 - 2
pages/stock/index.js

@@ -11,11 +11,11 @@ Page({
         // 主体高度
         infoHeight: '',
         // 库存列表
-        list: [{ id: '1234567', name: '11', type_name: '办公室生活用品', num: '11', money: '111', brief: '无' }],
+        list: [],
         // 弹框
         dialog: { title: '详细信息', show: false, type: '1' },
         // 详细信息
-        info: { id: '1234567', name: '11', type_name: '办公室生活用品', num: '11', money: '111', brief: '无' },
+        info: {},
         // 类型
         typeList: []
     },
@@ -28,6 +28,8 @@ Page({
     },
     // 详细信息
     toView: function (e) {
+        let data = { id: '1234567', name: '11', type_name: '办公室生活用品', num: '11', money: '111', brief: '无' }
+        this.setData({ info: data })
         this.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
     },
     // 信息变更
@@ -39,9 +41,30 @@ Page({
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
+        // 监听用户是否登录
+        this.watchLogin();
         // 计算高度
         this.searchHeight()
     },
+    // 监听用户是否登录
+    watchLogin: function () {
+        let data = [{ id: '1234567', name: '11', type_name: '办公室生活用品', num: '11', money: '111', brief: '无' }]
+        this.setData({ list: data })
+        // wx.getStorage({
+        // key: 'user',
+        // success: res => {
+        //   if (res.data) {
+        //     // 查询菜单
+        //     if (res.data) this.searchRouter(res.data);
+        //     res.data.type = type.find((i) => i.value == res.data.type).label;
+        //     if (res.data) this.setData({ userInfo: res.data });
+        //     if (res.data && res.data.avatarUrl) this.setData({ avatarUrl: res.data.avatarUrl });
+        //   } else {
+        //     wx.redirectTo({ url: '/pages/login/index', })
+        //   }
+        // }
+        // })
+    },
     // 计算高度
     searchHeight: function () {
         let frameStyle = this.data.frameStyle;

+ 20 - 3
pages/stock_order/index.js

@@ -25,6 +25,8 @@ Page({
     },
     // 详细信息
     toView: function (e) {
+        let data = { id: '1234567', code: '8', name: '其他' }
+        this.setData({ info: data })
         this.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
     },
     // 订单签收
@@ -39,12 +41,27 @@ Page({
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
-        this.search();
+        // 监听用户是否登录
+        this.watchLogin();
         // 计算高度
         this.searchHeight();
     },
-    search: function (data) {
-        console.log(data);
+    // 监听用户是否登录
+    watchLogin: function () {
+        // wx.getStorage({
+        // key: 'user',
+        // success: res => {
+        //   if (res.data) {
+        //     // 查询菜单
+        //     if (res.data) this.searchRouter(res.data);
+        //     res.data.type = type.find((i) => i.value == res.data.type).label;
+        //     if (res.data) this.setData({ userInfo: res.data });
+        //     if (res.data && res.data.avatarUrl) this.setData({ avatarUrl: res.data.avatarUrl });
+        //   } else {
+        //     wx.redirectTo({ url: '/pages/login/index', })
+        //   }
+        // }
+        // })
     },
     // 计算高度
     searchHeight: function () {

+ 26 - 0
pages/type/detail.js

@@ -11,6 +11,7 @@ Page({
     // 主体高度
     infoHeight: '',
     // 详细信息
+    id: '',
     form: {},
   },
   initValidate() {
@@ -43,9 +44,34 @@ Page({
   onLoad: function (options) {
     //验证规则函数
     this.initValidate();
+    if (options.id) this.setData({ id: options.id })
+    // 监听用户是否登录
+    this.watchLogin();
     // 计算高度
     this.searchHeight()
   },
+  // 监听用户是否登录
+  watchLogin: function () {
+    const that = this;
+    let id = that.data.id;
+    if (id) {
+      // 如果有ID查询数据详情,赋值给form
+    }
+    // wx.getStorage({
+    // key: 'user',
+    // success: res => {
+    //   if (res.data) {
+    //     // 查询菜单
+    //     if (res.data) this.searchRouter(res.data);
+    //     res.data.type = type.find((i) => i.value == res.data.type).label;
+    //     if (res.data) this.setData({ userInfo: res.data });
+    //     if (res.data && res.data.avatarUrl) this.setData({ avatarUrl: res.data.avatarUrl });
+    //   } else {
+    //     wx.redirectTo({ url: '/pages/login/index', })
+    //   }
+    // }
+    // })
+  },
   // 计算高度
   searchHeight: function () {
     let frameStyle = this.data.frameStyle;

+ 25 - 2
pages/type/index.js

@@ -10,11 +10,11 @@ Page({
         frameStyle: { useTop: true, name: '商品类型管理', leftArrow: true, useBar: false },
         // 主体高度
         infoHeight: '',
-        list: [{ id: '1234567', code: '8', name: '其他' }],
+        list: [],
         // 弹框
         dialog: { title: '详细信息', show: false, type: '1' },
         // 详细信息
-        info: { id: '1234567', code: '8', name: '其他' },
+        info: {},
     },
     back: function () {
         wx.navigateBack({ url: '/pages/home/index' })
@@ -25,6 +25,8 @@ Page({
     },
     // 详细信息
     toView: function (e) {
+        let data = { id: '1234567', code: '8', name: '其他' }
+        this.setData({ info: data })
         this.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
     },
     // 信息变更
@@ -36,9 +38,30 @@ Page({
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
+        // 监听用户是否登录
+        this.watchLogin();
         // 计算高度
         this.searchHeight()
     },
+    // 监听用户是否登录
+    watchLogin: function () {
+        let data = [{ id: '1234567', code: '8', name: '其他' }]
+        this.setData({ list: data })
+        // wx.getStorage({
+        // key: 'user',
+        // success: res => {
+        //   if (res.data) {
+        //     // 查询菜单
+        //     if (res.data) this.searchRouter(res.data);
+        //     res.data.type = type.find((i) => i.value == res.data.type).label;
+        //     if (res.data) this.setData({ userInfo: res.data });
+        //     if (res.data && res.data.avatarUrl) this.setData({ avatarUrl: res.data.avatarUrl });
+        //   } else {
+        //     wx.redirectTo({ url: '/pages/login/index', })
+        //   }
+        // }
+        // })
+    },
     // 计算高度
     searchHeight: function () {
         let frameStyle = this.data.frameStyle;

+ 26 - 1
pages/user/detail.js

@@ -11,7 +11,7 @@ Page({
     frameStyle: { useTop: true, name: '基本信息', leftArrow: true, useBar: false },
     // 主体高度
     infoHeight: '',
-    info: { id: '1234567', name: '测试人员', phone: '12345678901', email: '123456@qq.com', address: '1', dept: '1', zw: '1', company: '1', type: '0', type_name: '超级管理员' },
+    id: '',
     form: {},
     // 用户类别
     typeList: type
@@ -53,9 +53,34 @@ Page({
   onLoad: function (options) {
     //验证规则函数
     this.initValidate();
+    if (options.id) this.setData({ id: options.id })
+    // 监听用户是否登录
+    this.watchLogin();
     // 计算高度
     this.searchHeight()
   },
+  // 监听用户是否登录
+  watchLogin: function () {
+    const that = this;
+    let id = that.data.id;
+    if (id) {
+      // 如果有ID查询数据详情,赋值给form
+    }
+    // wx.getStorage({
+    // key: 'user',
+    // success: res => {
+    //   if (res.data) {
+    //     // 查询菜单
+    //     if (res.data) this.searchRouter(res.data);
+    //     res.data.type = type.find((i) => i.value == res.data.type).label;
+    //     if (res.data) this.setData({ userInfo: res.data });
+    //     if (res.data && res.data.avatarUrl) this.setData({ avatarUrl: res.data.avatarUrl });
+    //   } else {
+    //     wx.redirectTo({ url: '/pages/login/index', })
+    //   }
+    // }
+    // })
+  },
   // 计算高度
   searchHeight: function () {
     let frameStyle = this.data.frameStyle;

+ 25 - 2
pages/user/index.js

@@ -11,11 +11,11 @@ Page({
     // 主体高度
     infoHeight: '',
     // 信息列表
-    list: [{ id: '1234567', name: '测试人员', phone: '12345678901', email: '123456@qq.com' }],
+    list: [],
     // 弹框
     dialog: { title: '详细信息', show: false, type: '1' },
     // 详细信息
-    info: { id: '1234567', name: '测试人员', phone: '12345678901', email: '123456@qq.com', address: '1', dept: '1', zw: '1', company: '1', type: '超级管理员' },
+    info: {},
   },
   back: function () {
     wx.navigateBack({ url: '/pages/home/index' })
@@ -26,6 +26,8 @@ Page({
   },
   // 详细信息
   toView: function (e) {
+    let data = {id: '1234567', name: '测试人员', phone: '12345678901', email: '123456@qq.com', address: '1', dept: '1', zw: '1', company: '1', type: '超级管理员' }
+    this.setData({ info: data })
     this.setData({ dialog: { title: '详细信息', show: true, type: '1' } })
   },
   // 信息变更
@@ -62,9 +64,30 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    // 监听用户是否登录
+    this.watchLogin();
     // 计算高度
     this.searchHeight()
   },
+  // 监听用户是否登录
+  watchLogin: function () {
+    let data = [{ id: '1234567', name: '测试人员', phone: '12345678901', email: '123456@qq.com' }]
+    this.setData({ list: data })
+    // wx.getStorage({
+    // key: 'user',
+    // success: res => {
+    //   if (res.data) {
+    //     // 查询菜单
+    //     if (res.data) this.searchRouter(res.data);
+    //     res.data.type = type.find((i) => i.value == res.data.type).label;
+    //     if (res.data) this.setData({ userInfo: res.data });
+    //     if (res.data && res.data.avatarUrl) this.setData({ avatarUrl: res.data.avatarUrl });
+    //   } else {
+    //     wx.redirectTo({ url: '/pages/login/index', })
+    //   }
+    // }
+    // })
+  },
   // 计算高度
   searchHeight: function () {
     let frameStyle = this.data.frameStyle;