Commit c9c5c91d by liangjianmin

还原xk的自营

parent a88bdd5a
...@@ -9,20 +9,23 @@ const state = { ...@@ -9,20 +9,23 @@ const state = {
loading1:false, loading1:false,
ly1:false,//联营大陆得到数据防止切换多次请求 ly1:false,//联营大陆得到数据防止切换多次请求
ly2:false,//联营香港得到数据防止切换多次请求 ly2:false,//联营香港得到数据防止切换多次请求
zy1:false,//自营得到数据防止切换多次请求
ly1Data:[],//大陆数据 ly1Data:[],//大陆数据
ly2Data:[],//香港数据 ly2Data:[],//香港数据
zy1Data:[],//自营数据现货
zy2Data:[],//自营数据期货
ly1Length:0, ly1Length:0,
ly2Length:0, ly2Length:0,
zy1Length:0,//自营数据总长度
ly1LoseData:[], ly1LoseData:[],
ly2LoseData:[], ly2LoseData:[],
zy1LoseData:[],
priceInit:false, priceInit:false,
totlaMState:false totlaMState:false
} }
const mutations = { const mutations = {
cartList(state, payload) { cartList(state, payload) {
state.ly1Length=payload.data.cn_count;
state.ly2Length=payload.data.hk_count;
if(payload.types_==1){ if(payload.types_==1){
//大陆 //大陆
var arr_=payload.data.list; var arr_=payload.data.list;
...@@ -47,11 +50,32 @@ const mutations = { ...@@ -47,11 +50,32 @@ const mutations = {
state.ly2Data.push(arr_[i]) state.ly2Data.push(arr_[i])
} }
} }
}else{
//自营
var arr_=payload.data.list;
for(var i=0;i<arr_.length;i++){
arr_[i].editState=false;
if(arr_[i].status==-1){
state.zy1LoseData.push(arr_[i]);
}else{
if(arr_[i].sale_type==1){
//现货默认勾选
arr_[i].check=true;
state.zy1Data.push(arr_[i]);
}else{
//期货 //默认不勾选
arr_[i].check=false;
state.zy2Data.push(arr_[i])
}
}
}
} }
}, },
cartDelete(state,payload){ cartDelete(state,payload){
var ids=payload.cart_id.split(","); var ids=payload.cart_id.split(",");
if(payload.types==1){
//联营 //联营
if(payload.act=='normal'){ if(payload.act=='normal'){
//删除操作 //删除操作
...@@ -78,9 +102,34 @@ const mutations = { ...@@ -78,9 +102,34 @@ const mutations = {
state.ly2LoseData=[]; state.ly2LoseData=[];
} }
} }
}else{
//自营
if(payload.act=='normal'){
//删除
for(var i=0;i<state.zy1Data.length;i++){
for(var j=0;j<ids.length;j++){
if(state.zy1Data[i].cart_id==ids[j]){
state.zy1Data.splice(i,1);
}
}
}
for(var ii=0;ii<state.zy2Data.length;i++){
for(var jj=0;jj<ids.length;jj++){
if(state.zy2Data[ii].cart_id==ids[jj]){
state.zy2Data.splice(ii,1);
}
}
}
state.zy1Length=Number(state.zy1Length)-ids.length;
}else{
//清除过期数据
state.zy1LoseData=[];
}
}
}, },
changenum(state,payload){ changenum(state,payload){
if(payload.delivery_place==1||payload.delivery_place==2){
//大陆//香港 //大陆//香港
var list_=payload.delivery_place==1?state.ly1Data:state.ly2Data; var list_=payload.delivery_place==1?state.ly1Data:state.ly2Data;
for(var i=0;i<list_.length;i++){ for(var i=0;i<list_.length;i++){
...@@ -94,6 +143,37 @@ const mutations = { ...@@ -94,6 +143,37 @@ const mutations = {
} }
} }
}else{
//自营
var list_1=state.zy1Data,list_2=state.zy2Data;
for(var i=0;i<list_1.length;i++){
if(list_1[i].cart_id==payload.cart_id){
list_1[i].goods_number=payload.data.num;
list_1[i].goods_amount=payload.data.goods_amount;
list_1[i].goods_amount_format=payload.data.goods_amount_format;
list_1[i].goods_price=payload.data.goods_price;
list_1[i].goods_price_format=payload.data.goods_price_format;
if(payload.data.sale_type==2){
var arrj=list_1[i];
list_1.splice(i,1);
state.zy2Data.push(arrj)
}
}
}
for(var j=0;j<list_2.length;j++){
if(list_2[j].cart_id==payload.cart_id){
list_2[j].goods_number=payload.data.num;
list_2[j].goods_amount=payload.data.goods_amount;
list_2[j].goods_amount_format=payload.data.goods_amount_format;
list_2[j].goods_price=payload.data.goods_price;
if(payload.data.sale_type==1){
var arrj=list_2[j];
list_2.splice(j,1);
state.zy1Data.push(arrj)
}
}
}
}
state.totlaMState=true; state.totlaMState=true;
} }
} }
...@@ -122,6 +202,9 @@ const actions = { ...@@ -122,6 +202,9 @@ const actions = {
}else if(types_==2){ }else if(types_==2){
//香港 //香港
state.ly2=true; state.ly2=true;
}else{
//自营
state.zy1=true;
} }
if (data.err_code == 0) { if (data.err_code == 0) {
commit({ commit({
...@@ -140,7 +223,16 @@ const actions = { ...@@ -140,7 +223,16 @@ const actions = {
state.loading1=false; state.loading1=false;
}); });
}, },
allcount({commit},payload){
Services.allcount().then((res) => {
let data = res.data;
if (data.err_code == 0) {
state.ly1Length=Number(data.data['1']['1']||0);
state.ly2Length=Number(data.data['1']['2']||0);
state.zy1Length=Number(data.data['2']['1']||0);
}
})
},
cartDelete({commit},payload){ cartDelete({commit},payload){
state.loading=true; state.loading=true;
var params = { var params = {
......
This diff could not be displayed because it is too large.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment