Newer
Older
import {Component} from '@angular/core';
import {NavParams, ViewController} from "ionic-angular";
@Component({
selector: 'spces',
templateUrl: 'spces.html'
})
export class SpcesComponent {
goods;
model: '',
specs1: '',
specs2: '',
specs3: '',
specs4: '',
specs5: '',
};
constructor(private viewCtrl: ViewController, private params: NavParams,
this.goodsDetail = this.params.get('data');
if (this.goodsDetail) {
this.choose.amount = this.goodsDetail.amount;
this.choose.specs1 = this.goodsDetail.specs1;
this.choose.specs2 = this.goodsDetail.specs2;
this.choose.specs3 = this.goodsDetail.specs3;
this.choose.specs4 = this.goodsDetail.specs4;
this.choose.specs5 = this.goodsDetail.specs5;
}
this.serveSer.supplyDetail(this.goodsId).subscribe(
(res) => {
this.goods = res;
}
)
}
close() {
this.viewCtrl.dismiss();
}
stop(e) {
e.stopPropagation();
}
//增加
add() {
this.choose.amount++;
}
//减少
reduce() {
if (this.choose.amount > 1) {
this.choose.amount--;
}
}
//提交
submit() {
this.choose.brand = this.goods.brand;
this.choose.officeId = this.goods.id;
if (this.goods.specs1List && this.goods.specs1List.length > 0 && !this.choose.specs1) {
if (this.goods.specs2List && this.goods.specs2List.length > 0 && !this.choose.specs2) {
if (this.goods.specs3List && this.goods.specs3List.length > 0 && !this.choose.specs3) {
if (this.goods.specs4List && this.goods.specs4List.length > 0 && !this.choose.specs4) {
if (this.goods.specs5List && this.goods.specs5List.length > 0 && !this.choose.specs5) {
this.viewCtrl.dismiss(this.choose);
}
getSpecs(index, item) {
if (index == 1) this.choose.specs1 = item;
if (index == 2) this.choose.specs2 = item;
if (index == 3) this.choose.specs3 = item;
if (index == 4) this.choose.specs4 = item;
if (index == 5) this.choose.specs5 = item;
}
}