Commit 20e7f987 authored by wangqinghua's avatar wangqinghua

订购更新

parent c81d49f6
......@@ -7,11 +7,11 @@
"proxies": [
{
"path": "/wisdomgroup",
"proxyUrl": "http://218.78.19.169:8081/wisdomgroup"
"proxyUrl": "http://47.103.33.196:8080/wisdomgroup"
},
{
"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 {
this.serveSer.getGoodsInfo().subscribe(
(res) => {
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 == 1) this.navCtrl.push(RushBuyPage);
if (obj.isPurchasing == 2) this.commonSer.toast('今日物品已订购完,请明天再来');
;
} else {
this.commonSer.toast('暂无订购物品')
}
......
......@@ -8,28 +8,14 @@
<ion-content>
<ion-item (click)="chooseFood()">
<ion-label class="item-left"><span class="color-red">*</span>物品:</ion-label>
<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="item-box" *ngFor="let item of goodsInfo?.goodsStoreList">
<div class="left">{{item.goodsName}} <span>(余:{{item.everydayAmount - item.purchasedAmount}})</span>:</div>
<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 class="item-box">
<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>
<p class="buy-remark">{{goodsInfo?.remark}}</p>
<button class="submit-btn submit" (click)="save()">提交</button>
</ion-content>
......@@ -76,15 +76,24 @@ page-rush-buy {
border-bottom: 0.55px solid #eeeeee;
.left {
text-align: right;
width: 20%;
width: 40%;
font-weight: bold;
font-size: 1.4rem;
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 {
width: 80%;
width: 60%;
padding: 11px 8px 11px 16px;
.div-tag {
......
......@@ -9,18 +9,8 @@ import {CommonService} from "../../../../provide/common.service";
})
export class RushBuyPage {
obj = {
peopleCount: 10,
food: '',
foodText: '请选择',
type: null,
unitPrice: null,
purchaseVersion: null,
remark:null,
everydayAmount:null,
purchasedAmount:null
};
foodList;
goodsInfo;
constructor(public navCtrl: NavController, public navParams: NavParams, private commonSer: CommonService,
private actionSheetCtrl: ActionSheetController, private serveSer: ServeService,
......@@ -28,82 +18,58 @@ export class RushBuyPage {
}
ionViewDidLoad() {
console.log('ionViewDidLoad RushBuyPage');
this.getGoodsInfo();
}
getGoodsInfo() {
this.serveSer.getGoodsInfo().subscribe(
(res) => {
this.foodList = res.data;
this.obj.foodText = this.foodList[0].goodsName;
this.obj.purchaseVersion = this.foodList[0].version;
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;
this.goodsInfo = res.data[0];
this.goodsInfo.goodsStoreList.forEach(e => e.peopleCount = "0");
console.log(this.goodsInfo);
}
)
}
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() {
if (this.obj.peopleCount < 10) this.obj.peopleCount++;
add(item) {
if (item.peopleCount < 10) item.peopleCount++;
}
//减少
reduce() {
if (this.obj.peopleCount > 1) this.obj.peopleCount--;
reduce(item) {
if (item.peopleCount > 0) item.peopleCount--;
}
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('请选择物品');
return false;
}
if (sum > 10) {
this.commonSer.toast('总数最多选择10个');
return false;
}
const loading = this.loadCtrl.create({
content: '订购中...',
});
loading.present();
const data = {
diffFlag: '2',
type: this.obj.type,
peopleCount: this.obj.peopleCount,
unitPrice: this.obj.unitPrice,
version: this.obj.purchaseVersion
};
this.serveSer.saveMeals(data).subscribe(
const data = [];
this.goodsInfo.goodsStoreList.forEach(e => {
const d = {
type: this.goodsInfo.id,
reserve1: e.id,
peopleCount: e.peopleCount,
amount: e.unitPrice,
remark: this.goodsInfo.remark,
diffFlag: 2
};
data.push(d);
});
this.serveSer.savePurchase(data).subscribe(
(res) => {
loading.dismiss();
if (res.errcode == "1000") {
......
......@@ -91,8 +91,9 @@ export class HairCutPage {
this.page.isLoad = false;
this.applyList = res.data.list;
this.page.total = res.data.total;
this.applyList.forEach(e=>{
e.appointmentTime = new Date(e.appointmentDate+' 00:00:00').getTime();
this.applyList.forEach(e => {
const startTime = e.appointmentDate + " " + e.startEndStr.split("-")[0] + ":00";
e.appointmentTime = new Date(startTime).getTime();
})
timer(800).subscribe(e.complete());
}
......@@ -114,8 +115,9 @@ export class HairCutPage {
(res) => {
this.page.total = res.total;
this.applyList = this.applyList.concat(res.list);
this.applyList.forEach(e=>{
e.appointmentTime = new Date(e.appointmentDate+' 00:00:00').getTime();
this.applyList.forEach(e => {
const startTime = e.appointmentDate + " " + e.startEndStr.split("-")[0] + ":00";
e.appointmentTime = new Date(startTime).getTime();
})
timer(800).subscribe(() => e.complete());
}
......@@ -134,8 +136,9 @@ export class HairCutPage {
this.page.isLoad = false;
this.applyList = res.data.list;
this.page.total = res.data.total;
this.applyList.forEach(e=>{
e.appointmentTime = new Date(e.appointmentDate+' 00:00:00').getTime();
this.applyList.forEach(e => {
const startTime = e.appointmentDate + " " + e.startEndStr.split("-")[0] + ":00";
e.appointmentTime = new Date(startTime).getTime();
})
}
)
......@@ -147,7 +150,7 @@ export class HairCutPage {
this.commonSer.toast("已过期不可取消");
return;
}
this.commonSer.alert('确定取消?',()=>{
this.commonSer.alert('确定取消?', () => {
this.serveSer.cancelHair(item.id).subscribe(
(res) => {
if (res.errcode == 1000) {
......
This diff is collapsed.
......@@ -598,6 +598,8 @@ export class DiscoverPage {
this.obj.branchId = null;
}
this.getBanner();
this.pageNum = 1;
const data = {
pageNum: 1,
pageSize: this.pageSize,
......
......@@ -22,12 +22,10 @@ export class AppGlobal {
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
......
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