//获取应用实例
const app = getApp()
Page({
data: {
remark: ‘’,
goodsInfo: {},
receiveName: ‘’,
receiveMobile: ‘’,
receiveAddress: ‘’,
orderRemarks: ‘’,
couponUsed:“没有优惠劵”,
couponAmount: 0,//优惠金额
couponInfoListMap:[],
userCouponInfo:null,
goodsId: “”,
openId: “”,
goodsNum: 0,
goodsPrice: 0.0,//商品总金额
goodsLogisticsPrice: 0.0,
goodsTotalPrice: 0,//支付金额
currentColorIndex: 0,
currentColorId: “”,
currentColorText: “”,
currentLogisticsIndex: 0,
currentLogisticsType: 0,
currentLogisticsText: “”,
addCart: 0,
cartIds: “”,
goodsList: [],
curGoodsNums:{}
},
onLoad: function(opt) {
app.isLogin((data)=>{
let cartIdsValue = ‘’;
if(opt!=undefined){
cartIdsValue=opt.cartIds;
}
app.$post(app.API_ShowMyCart, {}, (res) => {
let cartIdsTmp = “”
for (let goods of res.data) {
//console.log(“goods.id=” + goods.id);
if (cartIdsTmp != “”){
cartIdsTmp = cartIdsTmp+“,”
}
cartIdsTmp = cartIdsTmp + goods.id
}
cartIdsValue = cartIdsTmp
//console.log(“cartIds=” + cartIdsValue);
this.GetGoodsInfo(cartIdsValue)
});
},‘1’)
},
onShow: function(opt){
this.onLoad();
},
selectLogistics(e) {
let index = e.currentTarget.dataset.index
let currentLogisticsText = e.currentTarget.dataset.logisticsname
let logisticsType = e.currentTarget.dataset.logisticstype
this.setData({
currentLogisticsIndex: index,
currentLogisticsType: logisticsType,
currentLogisticsText: currentLogisticsText
})
if (logisticsType != 2) {
this.setData({
goodsLogisticsPrice: 0
})
this.countTotalPrice()
} else {
this.getLogisticsFee()
}
},
getLogisticsFee() {
let orderParam = {
logisticsType: this.data.currentLogisticsType,
receiveAddress: this.data.receiveAddress
}
app.$post(app.API_getLogisticsFees, orderParam, (res) => {
if (res.statusCode == 0) {
let dataStatus = res.data.status
if (dataStatus == 2