工作记录1

1.vue 编辑页面

create 调用两个接口 

listSpu接口

 let vm = this;
   vm.uistate.loading =true;
   let payload = {
      params: {
        spu_code: ''
      },
      callback: {
        success: (result) => {
          vm.uistate.loading =false;
          vm.uistate.result = {
            resultcode: rests.SUCCEED
          }
          // 得到的货号的数值
          vm.spus = result;
          vm.filtered_spus = vm.spus;

        },
        failed: (resultcode, message, detail) => {
          vm.uistate.result = {
            resultcode: resultcode,
            messagesizes: message,
            detail: detail
          };
        },
        completed: () => {
          vm.uistate.loading = false;
        }
      }
    }
   this.listSpu(payload);

  getSku接口

this.model.kid = this.$route.query.kid;
   if (!this.model.kid) {
     this.uistate.loading = false;
     this.uistate.result = {
       resultcode: -1,
       message: '参数不能为空',
       detail: '请返回重试!'
     };
     return;
   }
   payload={
     params:{
        kid:vm.model.kid
     },
     callback : {
          success: (result) => {
            vm.model.kid=result.kid;
            vm.model.spu = result.spu_code;      //货号
            vm.model.remark = result.remark;     //备注
            vm.model.color = result.color;       //颜色
            vm.model.size = result.size;         //尺码
            vm.model.price = parseFloat(result.price/100).toFixed(2);   //价格,保留两位小数
            vm.model.barcode = result.barcode;   //条码
           },
         failed: (resultcode, message, detail) => {
             vm.uistate.result = {
               resultcode: resultcode,
               message: message,
               detail: detail
             };
             vm.uistate.loading = false;
           },
           completed: () => {}
         }
     };
   this.getSku(payload);

  

转载于:https://www.cnblogs.com/guangzhou11/p/9399428.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值