Commit 20e7f987 authored by wangqinghua's avatar wangqinghua

订购更新

parent c81d49f6
...@@ -7,11 +7,11 @@ ...@@ -7,11 +7,11 @@
"proxies": [ "proxies": [
{ {
"path": "/wisdomgroup", "path": "/wisdomgroup",
"proxyUrl": "http://218.78.19.169:8081/wisdomgroup" "proxyUrl": "http://47.103.33.196:8080/wisdomgroup"
}, },
{ {
"path": "/logistics", "path": "/logistics",
"proxyUrl": "http://218.78.19.169:8081/logistics" "proxyUrl": "http://47.103.33.196:8080/logistics"
} }
] ]
} }
...@@ -201,11 +201,10 @@ export class FoodPage { ...@@ -201,11 +201,10 @@ export class FoodPage {
this.serveSer.getGoodsInfo().subscribe( this.serveSer.getGoodsInfo().subscribe(
(res) => { (res) => {
if (res.data && res.data.length > 0) { if (res.data && res.data.length > 0) {
const obj = res.data[0]; const obj = res.data[0].goodsStoreList[0];
if (obj.isPurchasing == 0) this.commonSer.toast('订购时间为:' + obj.startTime + "~" + obj.endTime); if (obj.isPurchasing == 0) this.commonSer.toast('订购时间为:' + obj.startTime + "~" + obj.endTime);
if (obj.isPurchasing == 1) this.navCtrl.push(RushBuyPage); if (obj.isPurchasing == 1) this.navCtrl.push(RushBuyPage);
if (obj.isPurchasing == 2) this.commonSer.toast('今日物品已订购完,请明天再来'); if (obj.isPurchasing == 2) this.commonSer.toast('今日物品已订购完,请明天再来');
;
} else { } else {
this.commonSer.toast('暂无订购物品') this.commonSer.toast('暂无订购物品')
} }
......
...@@ -8,28 +8,14 @@ ...@@ -8,28 +8,14 @@
<ion-content> <ion-content>
<ion-item (click)="chooseFood()"> <div class="item-box" *ngFor="let item of goodsInfo?.goodsStoreList">
<ion-label class="item-left"><span class="color-red">*</span>物品:</ion-label> <div class="left">{{item.goodsName}} <span>(余:{{item.everydayAmount - item.purchasedAmount}})</span>:</div>
<ion-label [ngStyle]="{'color':obj.foodText == '请选择'?'#999':'#333'}"
class="choose">{{obj.foodText}}</ion-label>
<ion-label class="right-arrow">
<ion-icon name="arrow-forward"></ion-icon>
</ion-label>
</ion-item>
<div class="item-box">
<div class="left">剩余数量:</div>
<div class="right num"> <div class="right num">
{{obj?.everydayAmount - obj?.purchasedAmount}} <span class="reduce" (click)="reduce(item)">-</span>
<input type="number" value="1" [(ngModel)]="item.peopleCount">
<span class="add" (click)="add(item)">+</span>
</div> </div>
</div> </div>
<div class="item-box"> <p class="buy-remark">{{goodsInfo?.remark}}</p>
<div class="left">数量:</div>
<div class="right num">
<span class="reduce" (click)="reduce()">-</span>
<input type="number" value="1" [(ngModel)]="obj.peopleCount">
<span class="add" (click)="add()">+</span>
</div>
</div>
<p class="buy-remark">{{obj.remark}}</p>
<button class="submit-btn submit" (click)="save()">提交</button> <button class="submit-btn submit" (click)="save()">提交</button>
</ion-content> </ion-content>
...@@ -76,15 +76,24 @@ page-rush-buy { ...@@ -76,15 +76,24 @@ page-rush-buy {
border-bottom: 0.55px solid #eeeeee; border-bottom: 0.55px solid #eeeeee;
.left { .left {
text-align: right; width: 40%;
width: 20%;
font-weight: bold; font-weight: bold;
font-size: 1.4rem; font-size: 1.4rem;
margin: 11px 8px 11px 0; margin: 11px 8px 11px 0;
display: flex;
align-items: center;
justify-content: flex-end;
span {
display: inline-block;
font-size: 12px;
transform: scale(0.9);
font-weight: normal;
}
} }
.right { .right {
width: 80%; width: 60%;
padding: 11px 8px 11px 16px; padding: 11px 8px 11px 16px;
.div-tag { .div-tag {
......
...@@ -9,18 +9,8 @@ import {CommonService} from "../../../../provide/common.service"; ...@@ -9,18 +9,8 @@ import {CommonService} from "../../../../provide/common.service";
}) })
export class RushBuyPage { export class RushBuyPage {
obj = {
peopleCount: 10, goodsInfo;
food: '',
foodText: '请选择',
type: null,
unitPrice: null,
purchaseVersion: null,
remark:null,
everydayAmount:null,
purchasedAmount:null
};
foodList;
constructor(public navCtrl: NavController, public navParams: NavParams, private commonSer: CommonService, constructor(public navCtrl: NavController, public navParams: NavParams, private commonSer: CommonService,
private actionSheetCtrl: ActionSheetController, private serveSer: ServeService, private actionSheetCtrl: ActionSheetController, private serveSer: ServeService,
...@@ -28,82 +18,58 @@ export class RushBuyPage { ...@@ -28,82 +18,58 @@ export class RushBuyPage {
} }
ionViewDidLoad() { ionViewDidLoad() {
console.log('ionViewDidLoad RushBuyPage');
this.getGoodsInfo(); this.getGoodsInfo();
} }
getGoodsInfo() { getGoodsInfo() {
this.serveSer.getGoodsInfo().subscribe( this.serveSer.getGoodsInfo().subscribe(
(res) => { (res) => {
this.foodList = res.data; this.goodsInfo = res.data[0];
this.obj.foodText = this.foodList[0].goodsName; this.goodsInfo.goodsStoreList.forEach(e => e.peopleCount = "0");
this.obj.purchaseVersion = this.foodList[0].version; console.log(this.goodsInfo);
this.obj.unitPrice = this.foodList[0].unitPrice;
this.obj.type = this.foodList[0].id;
this.obj.remark = this.foodList[0].remark;
this.obj.purchasedAmount = this.foodList[0].purchasedAmount;
this.obj.everydayAmount = this.foodList[0].everydayAmount;
} }
) )
} }
chooseFood() {
const btnArr = this.foodList.map(e => {
const data = {
text: e.goodsName,
role: e.id,
handler: () => {
this.obj.foodText = e.goodsName;
this.obj.purchaseVersion = e.version;
this.obj.unitPrice = e.unitPrice;
this.obj.type = e.id;
this.obj.purchasedAmount = e.purchasedAmount;
this.obj.everydayAmount = e.everydayAmount;
}
};
return data;
});
btnArr.push({
text: '取消',
role: 'cancel',
handler: () => {
console.log('Cancel clicked');
}
});
const actionSheet = this.actionSheetCtrl.create({
cssClass: 'cameraAction',
buttons: btnArr
});
actionSheet.present();
}
//增加 //增加
add() { add(item) {
if (this.obj.peopleCount < 10) this.obj.peopleCount++; if (item.peopleCount < 10) item.peopleCount++;
} }
//减少 //减少
reduce() { reduce(item) {
if (this.obj.peopleCount > 1) this.obj.peopleCount--; if (item.peopleCount > 0) item.peopleCount--;
} }
save() { save() {
if (!this.obj.type) { let sum = 0;
this.goodsInfo.goodsStoreList.forEach((e) => sum += Number(e.peopleCount));
console.log(sum);
if (sum == 0) {
this.commonSer.toast('请选择物品'); this.commonSer.toast('请选择物品');
return false; return false;
} }
if (sum > 10) {
this.commonSer.toast('总数最多选择10个');
return false;
}
const loading = this.loadCtrl.create({ const loading = this.loadCtrl.create({
content: '订购中...', content: '订购中...',
}); });
loading.present(); loading.present();
const data = { const data = [];
diffFlag: '2', this.goodsInfo.goodsStoreList.forEach(e => {
type: this.obj.type, const d = {
peopleCount: this.obj.peopleCount, type: this.goodsInfo.id,
unitPrice: this.obj.unitPrice, reserve1: e.id,
version: this.obj.purchaseVersion peopleCount: e.peopleCount,
amount: e.unitPrice,
remark: this.goodsInfo.remark,
diffFlag: 2
}; };
this.serveSer.saveMeals(data).subscribe( data.push(d);
});
this.serveSer.savePurchase(data).subscribe(
(res) => { (res) => {
loading.dismiss(); loading.dismiss();
if (res.errcode == "1000") { if (res.errcode == "1000") {
......
...@@ -91,8 +91,9 @@ export class HairCutPage { ...@@ -91,8 +91,9 @@ export class HairCutPage {
this.page.isLoad = false; this.page.isLoad = false;
this.applyList = res.data.list; this.applyList = res.data.list;
this.page.total = res.data.total; this.page.total = res.data.total;
this.applyList.forEach(e=>{ this.applyList.forEach(e => {
e.appointmentTime = new Date(e.appointmentDate+' 00:00:00').getTime(); const startTime = e.appointmentDate + " " + e.startEndStr.split("-")[0] + ":00";
e.appointmentTime = new Date(startTime).getTime();
}) })
timer(800).subscribe(e.complete()); timer(800).subscribe(e.complete());
} }
...@@ -114,8 +115,9 @@ export class HairCutPage { ...@@ -114,8 +115,9 @@ export class HairCutPage {
(res) => { (res) => {
this.page.total = res.total; this.page.total = res.total;
this.applyList = this.applyList.concat(res.list); this.applyList = this.applyList.concat(res.list);
this.applyList.forEach(e=>{ this.applyList.forEach(e => {
e.appointmentTime = new Date(e.appointmentDate+' 00:00:00').getTime(); const startTime = e.appointmentDate + " " + e.startEndStr.split("-")[0] + ":00";
e.appointmentTime = new Date(startTime).getTime();
}) })
timer(800).subscribe(() => e.complete()); timer(800).subscribe(() => e.complete());
} }
...@@ -134,8 +136,9 @@ export class HairCutPage { ...@@ -134,8 +136,9 @@ export class HairCutPage {
this.page.isLoad = false; this.page.isLoad = false;
this.applyList = res.data.list; this.applyList = res.data.list;
this.page.total = res.data.total; this.page.total = res.data.total;
this.applyList.forEach(e=>{ this.applyList.forEach(e => {
e.appointmentTime = new Date(e.appointmentDate+' 00:00:00').getTime(); const startTime = e.appointmentDate + " " + e.startEndStr.split("-")[0] + ":00";
e.appointmentTime = new Date(startTime).getTime();
}) })
} }
) )
...@@ -147,7 +150,7 @@ export class HairCutPage { ...@@ -147,7 +150,7 @@ export class HairCutPage {
this.commonSer.toast("已过期不可取消"); this.commonSer.toast("已过期不可取消");
return; return;
} }
this.commonSer.alert('确定取消?',()=>{ this.commonSer.alert('确定取消?', () => {
this.serveSer.cancelHair(item.id).subscribe( this.serveSer.cancelHair(item.id).subscribe(
(res) => { (res) => {
if (res.errcode == 1000) { if (res.errcode == 1000) {
......
This diff is collapsed.
...@@ -598,6 +598,8 @@ export class DiscoverPage { ...@@ -598,6 +598,8 @@ export class DiscoverPage {
this.obj.branchId = null; this.obj.branchId = null;
} }
this.getBanner(); this.getBanner();
this.pageNum = 1;
const data = { const data = {
pageNum: 1, pageNum: 1,
pageSize: this.pageSize, pageSize: this.pageSize,
......
...@@ -22,12 +22,10 @@ export class AppGlobal { ...@@ -22,12 +22,10 @@ export class AppGlobal {
static domain = ""; //本地环境 static domain = ""; //本地环境
//图片地址 //图片地址
// static picture = AppGlobal.domain + "/wisdomgroup/manager/getIcon/"; //正式地址 static picture = AppGlobal.domain + "/wisdomgroup/manager/getIcon/";
static picture = AppGlobal.domain + "/wisdomgroup/manager/getIcon/"; //测试
//通知公告图片参数 //通知公告图片参数
// static pictureNotice = AppGlobal.domain; //正式地址 static pictureNotice = AppGlobal.domain;
static pictureNotice = AppGlobal.domain; //测试
//默认版本 //默认版本
static defaultVersion = "4.6.0"; //dev static defaultVersion = "4.6.0"; //dev
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment