适配默认下单类型

master
gongfuxiang 2022-04-06 13:21:50 +08:00
parent 4b2157c82d
commit 44a622491d
1 changed files with 24 additions and 8 deletions

View File

@ -318,20 +318,21 @@
uni.stopPullDownRefresh();
if (res.data.code == 0) {
var data = res.data.data;
var upd_data = {
this.setData({
data_base: data.base || null,
info: data.info || null,
goods_category: data.goods_category || [],
cart: data.cart || null,
favor_user: data.favor_user || [],
tablecode: data.tablecode || null
};
//
if(upd_data.info != null && upd_data.info.buy_use_type_list[this.buy_use_type_index] == undefined) {
upd_data['buy_use_type_index'] = 0;
}
this.setData(upd_data);
});
//
this.setData({
buy_use_type_index: this.get_buy_use_type_index()
});
//
if ((this.info || null) != null) {
//
var status = this.favor_user.indexOf(this.info.id) != -1 ? 1 : 0;
@ -1070,7 +1071,22 @@
// 使0
get_buy_use_type_index() {
return uni.getStorageSync(this.cache_buy_use_type_index_key) || 0;
var index = uni.getStorageSync(this.cache_buy_use_type_index_key);
if((this.info || null) != null) {
// 使
if(index === null || index === '') {
//
if(this.info.default_buy_use_type != undefined && this.info.default_buy_use_type != -1) {
index = this.info.default_buy_use_type;
}
}
// 0
if(this.info.buy_use_type_list[index] == undefined) {
index = 0;
}
}
return index || 0;
},
//