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);