1.更新了体检上门
2.修复自费成功页面无法隐藏加载中页面问题
This commit is contained in:
229
pages/checkoutsm/checkoutsm.js
Normal file
229
pages/checkoutsm/checkoutsm.js
Normal file
@@ -0,0 +1,229 @@
|
||||
var util = require('../../utils/util.js');
|
||||
var api = require('../../config/api.js');
|
||||
|
||||
var app = getApp();
|
||||
|
||||
Page({
|
||||
data: {
|
||||
isTipsShow: false, //控制确认提示信息对话框
|
||||
|
||||
//上一个页面带来的信息
|
||||
isShow: false,
|
||||
selectName: '',
|
||||
selectNationId: '',
|
||||
selectClassName: '',
|
||||
selectSchoolName: '',
|
||||
selectPatid: '',
|
||||
list: [], //成功开单信息
|
||||
listfail: [], //失败开单信息
|
||||
|
||||
hideStadndard: null,
|
||||
hideAddtion: null,
|
||||
checkStandardList: [],
|
||||
checkStandardContent: '',
|
||||
checkAddtionList: [],
|
||||
orderTotalPrice: 0.00, //基础总价
|
||||
orderTotalPriceAddtion: 0.00, //附加总价
|
||||
totalPrice: 0.00, //总价
|
||||
totalPriceDisp: '',
|
||||
message: ''
|
||||
},
|
||||
onLoad: function(options) {
|
||||
// 页面初始化 options为页面跳转所带来的参数
|
||||
var that = this;
|
||||
|
||||
that.setData({
|
||||
checkStandardList: app.globalData.gStandardList,
|
||||
checkStandardContent: app.globalData.gStandardContent,
|
||||
checkAddtionList: app.globalData.gAddtionList
|
||||
});
|
||||
|
||||
this.setData({
|
||||
selectName:options.name,
|
||||
selectNationId:options.nationid,
|
||||
selectClassName:options.classname,
|
||||
selectSchoolName:options.schoolname,
|
||||
selectPatid: options.patid
|
||||
})
|
||||
// console.log(this.data.checkStandardList);
|
||||
|
||||
var filterNum = this.data.checkStandardList.filter(function(person,index,arrs){
|
||||
return person.checked==true
|
||||
});
|
||||
if(filterNum.length == 0) {
|
||||
that.setData({
|
||||
hideStadndard: 0,
|
||||
checkStandardList: filterNum
|
||||
});
|
||||
}else{
|
||||
that.setData({
|
||||
hideStadndard: 1,
|
||||
checkStandardList: filterNum
|
||||
});
|
||||
}
|
||||
// console.log(this.data.hideStadndard);
|
||||
console.log("filterNum");
|
||||
console.log(filterNum);
|
||||
|
||||
var filterNum1 = this.data.checkAddtionList.filter(function(person,index,arrs){
|
||||
return person.checked==true
|
||||
});
|
||||
if(filterNum1.length == 0) {
|
||||
that.setData({
|
||||
hideAddtion: 0,
|
||||
checkAddtionList: filterNum1
|
||||
});
|
||||
}else{
|
||||
that.setData({
|
||||
hideAddtion: 1,
|
||||
checkAddtionList: filterNum1
|
||||
});
|
||||
}
|
||||
// console.log(this.data.hideAddtion);
|
||||
console.log("filterNum1");
|
||||
console.log(filterNum1);
|
||||
|
||||
//计算总金额
|
||||
this.data.checkStandardList.forEach((item) => {
|
||||
console.log(item);
|
||||
this.data.orderTotalPrice = this.data.orderTotalPrice + parseFloat(item.itemprice)*100;
|
||||
});
|
||||
console.log(this.data.orderTotalPrice/100);
|
||||
|
||||
this.data.checkAddtionList.forEach((item) => {
|
||||
console.log(item);
|
||||
this.data.orderTotalPriceAddtion = this.data.orderTotalPriceAddtion + parseFloat(item.itemprice)*100;
|
||||
});
|
||||
console.log(this.data.orderTotalPriceAddtion/100);
|
||||
|
||||
this.data.totalPrice = (this.data.orderTotalPrice + this.data.orderTotalPriceAddtion) / 100;
|
||||
|
||||
this.setData({
|
||||
totalPriceDisp: this.data.totalPrice.toString()
|
||||
});
|
||||
console.log(this.data.totalPriceDisp);
|
||||
|
||||
},
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {
|
||||
|
||||
},
|
||||
//获取checkou信息
|
||||
getCheckoutInfo: function() {
|
||||
let that = this;
|
||||
util.request(api.smCartCheckout, {
|
||||
cartId: that.data.cartId,
|
||||
addressId: that.data.addressId,
|
||||
couponId: that.data.couponId,
|
||||
userCouponId: that.data.userCouponId,
|
||||
grouponRulesId: that.data.grouponRulesId
|
||||
}).then(function(res) {
|
||||
if (res.errno === 0) {
|
||||
that.setData({
|
||||
checkedGoodsList: res.data.checkedGoodsList,
|
||||
checkedAddress: res.data.checkedAddress,
|
||||
availableCouponLength: res.data.availableCouponLength,
|
||||
actualPrice: res.data.actualPrice,
|
||||
couponPrice: res.data.couponPrice,
|
||||
grouponPrice: res.data.grouponPrice,
|
||||
freightPrice: res.data.freightPrice,
|
||||
goodsTotalPrice: res.data.goodsTotalPrice,
|
||||
orderTotalPrice: res.data.orderTotalPrice,
|
||||
addressId: res.data.addressId,
|
||||
couponId: res.data.couponId,
|
||||
userCouponId: res.data.userCouponId,
|
||||
grouponRulesId: res.data.grouponRulesId,
|
||||
});
|
||||
}
|
||||
wx.hideLoading();
|
||||
});
|
||||
},
|
||||
bindMessageInput: function(e) {
|
||||
this.setData({
|
||||
message: e.detail.value
|
||||
});
|
||||
},
|
||||
onReady: function() {
|
||||
// 页面渲染完成
|
||||
|
||||
},
|
||||
onShow: function() {
|
||||
// 页面显示
|
||||
// wx.showLoading({
|
||||
// title: '加载中...',
|
||||
// });
|
||||
|
||||
//this.getCheckoutInfo();
|
||||
|
||||
|
||||
|
||||
},
|
||||
onHide: function() {
|
||||
// 页面隐藏
|
||||
|
||||
},
|
||||
onUnload: function() {
|
||||
// 页面关闭
|
||||
|
||||
},
|
||||
onNavToJF: function() {
|
||||
// setTimeout(item => {
|
||||
// wx.navigateBack({
|
||||
// delta: 3 //返回上一级页面
|
||||
// })
|
||||
// },1000)
|
||||
wx.navigateBack({
|
||||
delta: 3 //返回上一级页面
|
||||
})
|
||||
|
||||
wx.navigateTo({
|
||||
url: '/pages/payment/payment',
|
||||
})
|
||||
},
|
||||
|
||||
onConfirmTips: function(){
|
||||
util.requestPost(api.smorderinfo, {
|
||||
patid: this.data.selectPatid,
|
||||
name: this.data.selectName,
|
||||
className: this.data.selectClassName,
|
||||
schoolName: this.data.selectSchoolName,
|
||||
nationId: this.data.selectNationId,
|
||||
iteminfo: this.data.checkStandardList,
|
||||
itemkxinfo: this.data.checkAddtionList
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
if (res.errCode === '0') {
|
||||
this.setData({
|
||||
list: res.list,
|
||||
listfail: res.listF,
|
||||
isShow: true
|
||||
})
|
||||
// wx.showToast({
|
||||
// title: '开单成功',
|
||||
// icon:'success'
|
||||
// })
|
||||
|
||||
// setTimeout(item => {
|
||||
// wx.navigateBack({
|
||||
// delta: 3 //返回上一级页面
|
||||
// })
|
||||
// },1000)
|
||||
} else {
|
||||
util.showErrorToast(res.errmsg);
|
||||
}
|
||||
});
|
||||
},
|
||||
onCancelTips: function(){
|
||||
wx.navigateBack({
|
||||
delta: 1 //返回上一级页面
|
||||
})
|
||||
},
|
||||
submitOrder: function() {
|
||||
this.setData({
|
||||
isTipsShow: true
|
||||
});
|
||||
console.log("tips");
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user