A sku click judgment module written by an Android buddy. Can anyone help change it to js?
//
resultMap = CustomSKU.skuCollection(haskey.prices);
//
for (GoodsTypesBean.DataBean.KeysBean key : haskey.keys) {
for (GoodsTypesBean.DataBean.KeysBean.ValuesBean value : key.values) {
//value 0
if (resultMap.get(value.valueid + "") == null || resultMap.get(value.valueid + "").stock <= 0) {
value.status = 2;
}
}
}
//
goodsdetailsAttribute.setAdapter(mGoodsDetailsAttributeAdapter = new GoodsDetailsAttributeAdapter(this, haskey.keys, new ChooseGoodsSizeTypesAdapter.AotoFlowItemClick() {
@Override
public void clickFlowItem() {
//
//value
mSelectedValues.clear();
//value
for (GoodsTypesBean.DataBean.KeysBean keysBean : mGoodsDetailsAttributeAdapter.list) {
for (GoodsTypesBean.DataBean.KeysBean.ValuesBean value : keysBean.values) {
if (value.status == 1) {
mSelectedValues.add(value);
}
}
}
//
for (GoodsTypesBean.DataBean.KeysBean keysBean : mGoodsDetailsAttributeAdapter.list) {
for (GoodsTypesBean.DataBean.KeysBean.ValuesBean value : keysBean.values) {
//List
List<GoodsTypesBean.DataBean.KeysBean.ValuesBean> cacheList = new ArrayList<>();
//item
cacheList.add(value);
//item
cacheList.addAll(mSelectedValues);
//keyid
for (int j = 0; j < cacheList.size() - 1; jPP) {
for (int k = 0; k < cacheList.size() - 1 - j; kPP) {
GoodsTypesBean.DataBean.KeysBean.ValuesBean cacheEntity;
if (cacheList.get(k).keyid > cacheList.get(k + 1).keyid) {
cacheEntity = cacheList.get(k);
cacheList.set(k, cacheList.get(k + 1));
cacheList.set(k + 1, cacheEntity);
}
}
}
// key
for (int i = 0; i < cacheList.size() - 1; iPP) {
for (int j = 0; j < cacheList.size() - 1 - i; jPP) {
if (cacheList.get(j).keyid == cacheList.get(j + 1).keyid) {
cacheList.remove(j + 1);
}
}
}
// 1;5
StringBuffer mStringBuffer = new StringBuffer();
for (GoodsTypesBean.DataBean.KeysBean.ValuesBean valuesBean : cacheList) {
mStringBuffer.append(valuesBean.valueid + ";");
}
// key 0
if (resultMap.get(mStringBuffer.substring(0, mStringBuffer.length() - 1)) != null && resultMap.get(mStringBuffer.substring(0, mStringBuffer.length() - 1)).stock > 0) {
//keystatus
value.status = value.status == 1 ? 1 : 0;
} else {
//
value.status = 2;
}
}
}