#
whycq
2023-11-01 3f188253e8ce35fc403dd38c666e6246e589b742
pages/api/addMat.js
@@ -1,36 +1,26 @@
async function addMat() {
let network = uni.getStorageSync('Network')
let baseUrl = `http://${network[0].ip}:${network[0].port}/${network[0].address}`
async function addMat(matnr) {
   let that = this,item = {};
   var res = await uni.request({
      url: 'http://127.0.0.1:8089/bfwms/mat/auth',
      data: {matnr: '3CPPJ.B.GMB.LZ.QBY4-10/15P316LLZ'},
   }).then((res)=> {
      let mat = res.data.data
   var ress = await uni.request({
      url: `${baseUrl}/mat/auth`,
      header: {'token': uni.getStorageSync('token')},
      data: {matnr: matnr},
   }).then((result)=> {
      let mat = result.data.data
      item['detl'] = [
         {key: '商品码',value: mat.matnr},
         {key: '商品名称',value: mat.maktx},
         {key: '规格',value: mat.specs},
         {key: '数量',value: 100},
         {key: '批号',value: '',type: 'input'},
         {key: '数量',value: 0,type: 'number-box',valText: 'val-num'},
      ]
   },(res)=>{
      console.log(res);
   })
   // success(res) {
   //    result = res.data.data
   //    console.log(result);
   //    // res = res.data
   //    // let mat = res.data
   //    // let item = {}
   //    // item['detl'] = [
   //    //    {key: '商品码',value: mat.matnr},
   //    //    {key: '商品名称',value: mat.maktx},
   //    //    {key: '规格',value: mat.specs},
   //    //    {key: '数量',value: 100},
   //    // ]
   //    // that.zDataList.push(item)
   // }
   return item
}
module.exports = {
   addMat: addMat
   addMat: addMat,
}