/**
* 获取当前订单信息
* 接收参数
* 无需接收参数,从页面数据中取值
* 接口传参
* querystr:订单数据密钥字符串
*/
getorderdata() {
let _this = this;
if (_this.data.is_buy_pay && _this.data.options.querystr) {
return false;
} else if (_this.data.is_cart_pay && !_this.data.options.querystr) {
return false;
} else {
app._requestpost(_this, app.globaldata.config.shopproductbuyurl, {querystr: _this.data.options.querystr},
function (res) {
// 优惠券价格变为整数
let coupon_list = res.data.coupon_data;
if (coupon_list) {
coupon_list.foreach((value, index) => {
value["coupon_price"] = parseint(value["coupon_price"])
});
}
let unuse_coupon_list = res.data.unuse_coupon_data;
if (unuse_coupon_list) {
unuse_coupon_list.foreach((value, index) => {
value["coupon_price"] = parseint(value["coupon_price"])
});
}
// 商品规格处理
let prom_type = _this.data.prom_type;
let product_data = res.data.product_data;
if (product_data) {
product_data.foreach(item => {
let product_spec = item.product_spec.split(';')
_this.setdata({product_spec: product_spec});
if (1 == prom_type && 0 == item.prom_type) prom_type = 0;
});
}
// 加载数据到页面
let userinfo = res.data.users;
let address = res.data.address;
let global_info = res.data.global_info;
let exist_address = address.addr_id ? true : false;
_this.setdata({product_data, global_info, address, exist_address, coupon_list, unuse_coupon_list, prom_type, userinfo});
},
function (res) {
app.showerror(res.msg);
}
);
}
},