Commit c9c5c91d by liangjianmin

还原xk的自营

parent a88bdd5a
......@@ -9,20 +9,23 @@ const state = {
loading1:false,
ly1:false,//联营大陆得到数据防止切换多次请求
ly2:false,//联营香港得到数据防止切换多次请求
zy1:false,//自营得到数据防止切换多次请求
ly1Data:[],//大陆数据
ly2Data:[],//香港数据
zy1Data:[],//自营数据现货
zy2Data:[],//自营数据期货
ly1Length:0,
ly2Length:0,
zy1Length:0,//自营数据总长度
ly1LoseData:[],
ly2LoseData:[],
zy1LoseData:[],
priceInit:false,
totlaMState:false
}
const mutations = {
cartList(state, payload) {
state.ly1Length=payload.data.cn_count;
state.ly2Length=payload.data.hk_count;
if(payload.types_==1){
//大陆
var arr_=payload.data.list;
......@@ -47,53 +50,130 @@ const mutations = {
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){
var ids=payload.cart_id.split(",");
//联营
if(payload.act=='normal'){
//删除操作
var datalistp=payload.delivery==1?state.ly1Data:state.ly2Data;
for(var i=0;i<datalistp.length;i++){
for(var j=0;j<ids.length;j++){
if(datalistp[i].cart_id==ids[j]){
datalistp.splice(i,1);
if(payload.types==1){
//联营
if(payload.act=='normal'){
//删除操作
var datalistp=payload.delivery==1?state.ly1Data:state.ly2Data;
for(var i=0;i<datalistp.length;i++){
for(var j=0;j<ids.length;j++){
if(datalistp[i].cart_id==ids[j]){
datalistp.splice(i,1);
}
}
}
}
if(payload.delivery==1){
state.ly1Data=datalistp;
state.ly1Length=Number(state.ly1Length)-ids.length;
if(payload.delivery==1){
state.ly1Data=datalistp;
state.ly1Length=Number(state.ly1Length)-ids.length;
}else{
state.ly2Data=datalistp;
state.ly2Length=Number(state.ly2Length)-ids.length;
}
}else{
state.ly2Data=datalistp;
state.ly2Length=Number(state.ly2Length)-ids.length;
//清除过期数据
if(payload.delivery==1){
state.ly1LoseData=[];
}else{
state.ly2LoseData=[];
}
}
}else{
//清除过期数据
if(payload.delivery==1){
state.ly1LoseData=[];
//自营
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.ly2LoseData=[];
//清除过期数据
state.zy1LoseData=[];
}
}
},
changenum(state,payload){
//大陆//香港
var list_=payload.delivery_place==1?state.ly1Data:state.ly2Data;
for(var i=0;i<list_.length;i++){
if(list_[i].cart_id==payload.cart_id){
list_[i].goods_number=payload.data.num;
list_[i].goods_amount=payload.data.goods_amount;
list_[i].goods_amount_format=payload.data.goods_amount_format;
list_[i].goods_price=payload.data.goods_price;
list_[i].goods_price_format=payload.data.goods_price_format;
}
}
if(payload.delivery_place==1||payload.delivery_place==2){
//大陆//香港
var list_=payload.delivery_place==1?state.ly1Data:state.ly2Data;
for(var i=0;i<list_.length;i++){
if(list_[i].cart_id==payload.cart_id){
list_[i].goods_number=payload.data.num;
list_[i].goods_amount=payload.data.goods_amount;
list_[i].goods_amount_format=payload.data.goods_amount_format;
list_[i].goods_price=payload.data.goods_price;
list_[i].goods_price_format=payload.data.goods_price_format;
}
}
}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;
}
}
......@@ -122,6 +202,9 @@ const actions = {
}else if(types_==2){
//香港
state.ly2=true;
}else{
//自营
state.zy1=true;
}
if (data.err_code == 0) {
commit({
......@@ -140,7 +223,16 @@ const actions = {
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){
state.loading=true;
var params = {
......
<template>
<div class="car-page">
<!--联营盒子-->
<div class="lxBox" :style="{'paddingTop':paddingTop+'px'}">
<div class="lxBox" v-show="type==1" :style="{'paddingTop':paddingTop+'px'}">
<div class="lyNav clr lyfixed">
<span class="fl" :class="{'act':(delivery==1)}" @click="deliveryTab(1)"
v-back-top-window>大陆交货({{ly1Length}})<font class="fr">|</font></span>
<span class="fl" :class="{'act':(delivery==2)}" @click="deliveryTab(2)"
v-back-top-window>香港交货({{ly2Length}})</span>
<span class="fl" :class="{'act':(delivery==1)}" @click="deliveryTab(1)" v-back-top-window>大陆交货({{ly1Length}})<font class="fr">|</font></span>
<span class="fl" :class="{'act':(delivery==2)}" @click="deliveryTab(2)" v-back-top-window>香港交货({{ly2Length}})</span>
</div>
<!--登录提示框-->
<div class="logintip lyfixed" v-if="!isLogingo">
......@@ -14,42 +12,37 @@
<a :href="loginUrl">登录</a>
</div>
<div class="dataBox">
<div class="dataBox" >
<!--编辑-->
<div class="editBox clr lyfixed" :style="{'top':(paddingTop+44)+'px'}" v-if="!isNoContent">
<span class="remind fl" @click="tipLy">友情提醒<i class="iconfont icon-tishi"></i></span>
<span class="remind fl" @click="tipLy">友情提醒<i class="iconfont icon-tishi" ></i></span>
<a href="javascript:void(0)" class="edit-btn fr" @click="isEditf()" v-if="isEdit">完成</a>
<a href="javascript:void(0)" class="edit-btn fr" @click="isEditf()" v-if="!isEdit">编辑</a>
</div>
<div class="dlBox" v-show="delivery==1">
<div class="mui-row shop-block sale_type_data" v-for="(item,indexdata) in ly1Data">
<div class="mui-row shop-block sale_type_data" v-for="(item,indexdata) in ly1Data">
<div class="mui-col-sm-1 mui-col-xs-1 ta-c mt-10 zdychec">
<van-checkbox v-model="item.check" @change="checkWatch"></van-checkbox>
</div>
<div class="mui-col-sm-11 mui-col-xs-11">
<h4 class="mui-row">
<h4 class="mui-row">
<p class="mui-col-sm-11 mui-col-xs-11">
<a :href="'/goods_'+item.goods_id+'.html'" class="f-333">{{item.sku_name}}</a>
</p>
<p class="mui-col-sm-1 mui-col-xs-1 ta-c">
<a href="javascript:void(0)" v-show="item.editState"
@click="deleteGoods(item.cart_id)"
class="icon iconfont icon-shanchu delete-tier f-333"></a>
<a href="javascript:void(0)" v-show="item.editState" @click="deleteGoods(item.cart_id)" class="icon iconfont icon-shanchu delete-tier f-333"></a>
</p>
</h4>
<div class="mt-10" v-if="item.ac_type==8&&item.activity_info"><span
class="hot-price">{{item.activity_info.sign_name}}</span>
<font class="f-red"> {{item.activity_info.activity_ad}}</font>
</div>
<ul class="mui-row">
<div class="mt-10" v-if="item.ac_type==8&&item.activity_info"><span class="hot-price">{{item.activity_info.sign_name}}</span><font class="f-red"> {{item.activity_info.activity_ad}}</font></div>
<ul class="mui-row">
<li class="mui-col-sm-8 mui-col-xs-8">
<span>制造商:</span>
<p>{{item.brand_name}}</p>
</li>
<li class="mui-col-sm-4 mui-col-xs-4 t-r huoqi">货期:{{(item.goods_type==3)?'立即发货':(item.delivery_time||'- -')}}</li>
<li class="mui-col-sm-4 mui-col-xs-4 t-r huoqi" >货期:{{item.delivery_time||'- -'}}</li>
<li class="mui-col-sm-8 mui-col-xs-8">
<span>供应商:</span>
<p>{{(item.goods_type==3)?'现货自营':(item.supplier_name||'- -')}}</p>
<p>{{item.supplier_name||'- -'}}</p>
</li>
<li class="mui-col-sm-4 mui-col-xs-4 t-r">
最小起订量:<font v-html="item.min_buy"></font>
......@@ -57,41 +50,34 @@
<li class="mui-col-sm-7 mui-col-xs-7">
标准包装量:<font v-html="item.min_mpq"></font>
</li>
<li class="mui-col-sm-5 mui-col-xs-5 danjia t-r">单价:{{item.goods_price_format}}</li>
<li class="mui-col-sm-5 mui-col-xs-5 danjia t-r" >单价:{{item.goods_price_format}}</li>
</ul>
<div class="mui-row">
<div class="mui-col-sm-7 mui-col-xs-7">
<div class="morePrice">
<div :id="'priceContent'+item.cart_id"
:class="{'lyClass':item.tiered&&item.tiered.length<4,'lyMoreData':item.tiered&&item.tiered.length>3}">
<div class="mui-row act" v-for="(itemPrice,index) in item.tiered"
:class="{'dataNo':(index>2)&&!item.priceCheck}">
<p class="mui-col-sm-3 mui-col-xs-3">
<font v-html="itemPrice.purchases"></font>+
</p>
<p class="mui-col-sm-4 mui-col-xs-4 f-red">
{{item.ac_type == 6?itemPrice.price_ac:itemPrice.price_cn}}</p>
<div
:id="'priceContent'+item.cart_id"
:class="{'lyClass':item.tiered&&item.tiered.length<4,'lyMoreData':item.tiered&&item.tiered.length>3}"
>
<div class="mui-row act" v-for="(itemPrice,index) in item.tiered"
:class="{'dataNo':(index>2)&&!item.priceCheck}">
<p class="mui-col-sm-3 mui-col-xs-3"><font v-html="itemPrice.purchases"></font>+</p>
<p class="mui-col-sm-4 mui-col-xs-4 f-red">{{item.ac_type == 6?itemPrice.price_ac:itemPrice.price_cn}}</p>
</div>
</div>
<div class="more-height" v-if="item.tiered&&item.tiered.length>3"
<div class="more-height" v-if="item.tiered&&item.tiered.length>3"
@click="priceRow(ly1Data,indexdata,item.cart_id)"
v-html="item.checkBtn||defaultBtn">更多梯度价格<i class="iconfont icon-bot"></i>
</div>
v-html="item.checkBtn||defaultBtn">更多梯度价格<i class="iconfont icon-bot"></i></div>
</div>
</div>
<div class="mui-col-sm-5 mui-col-xs-5">
<div class="clr add-num">
<div class="mui-numbox edit-input">
<button class="mui-btn mui-btn-numbox-minus " type="button"
@click="changeNumber(item.allow_presale,item.ac_type,item.goods_number,item.multiple,item.min_buy,item.stock,item.cart_id,1)">
<button class="mui-btn mui-btn-numbox-minus " type="button" @click="changeNumber(item.allow_presale,item.ac_type,item.goods_number,item.multiple,item.min_buy,item.stock,item.cart_id,1)">
<i class="icon iconfont icon-jian"></i>
</button>
<input class="mui-input-numbox valuep" type="number"
:id="'test'+item.cart_id"
@blur="changeNumber(item.allow_presale,item.ac_type,item.goods_number,item.multiple,item.min_buy,item.stock,item.cart_id,3)"
:value="item.goods_number | numberCode">
<button class="mui-btn mui-btn-numbox-plus " type="button"
@click="changeNumber(item.allow_presale,item.ac_type,item.goods_number,item.multiple,item.min_buy,item.stock,item.cart_id,2)">
<input class="mui-input-numbox valuep" type="number" :id="'test'+item.cart_id" @blur="changeNumber(item.allow_presale,item.ac_type,item.goods_number,item.multiple,item.min_buy,item.stock,item.cart_id,3)" :value="item.goods_number | numberCode">
<button class="mui-btn mui-btn-numbox-plus " type="button" @click="changeNumber(item.allow_presale,item.ac_type,item.goods_number,item.multiple,item.min_buy,item.stock,item.cart_id,2)">
<i class="icon iconfont icon-jia"></i>
</button>
</div>
......@@ -113,7 +99,7 @@
</dl>
</div>
<div class="sxData" v-for="item in ly1LoseData">
<div class="mui-row shop-block shop-lose">
<div class="mui-row shop-block shop-lose" >
<div class="mui-col-sm-1 mui-col-xs-1"></div>
<div class="mui-col-sm-11 mui-col-xs-11">
<h4 class="mui-row">
......@@ -122,13 +108,11 @@
</p>
</h4>
<ul class="mui-row">
<li class="mui-col-sm-8 mui-col-xs-8"><span>制造商:</span>
<p>{{item.brand_name}}</p>
</li>
<li class="mui-col-sm-4 mui-col-xs-4 t-r ">货期:{{(item.goods_type==3)?'立即发货':(item.delivery_time||'- -')}}</li>
<li class="mui-col-sm-8 mui-col-xs-8"><span>制造商:</span><p>{{item.brand_name}}</p></li>
<li class="mui-col-sm-4 mui-col-xs-4 t-r ">货期:{{item.delivery_time||'- -'}}</li>
<li class="mui-col-sm-8 mui-col-xs-8">
<span>供应商:</span>
<p>{{(item.goods_type==3)?'现货自营':(item.supplier_name||'- -')}}</p>
<p>{{item.supplier_name||'- -'}}</p>
</li>
<li class="mui-col-sm-4 mui-col-xs-4 t-r">
最小起订量:<font v-html="item.min_buy"></font>
......@@ -139,7 +123,7 @@
<li class="mui-col-sm-5 mui-col-xs-5 danjia t-r">单价:{{item.goods_price_format}}</li>
</ul>
<p class="lose-but">
<a :href="'/s/?k='+item.goods_name" class="fr but-bor-red ">去搜索</a>
<a :href="'/s/?k='+item.goods_name" class="fr but-bor-red " >去搜索</a>
<span>已失效</span>
</p>
</div>
......@@ -147,30 +131,28 @@
</div>
</div>
<div class="hkBox" v-show="delivery==2">
<div class="mui-row shop-block sale_type_data" v-for="(item,indexdata) in ly2Data">
<div class="mui-row shop-block sale_type_data" v-for="(item,indexdata) in ly2Data">
<div class="mui-col-sm-1 mui-col-xs-1 ta-c mt-10 zdychec">
<van-checkbox v-model="item.check" @change="checkWatch"></van-checkbox>
</div>
<div class="mui-col-sm-11 mui-col-xs-11">
<h4 class="mui-row">
<h4 class="mui-row">
<p class="mui-col-sm-11 mui-col-xs-11">
<a :href="'/goods_'+item.goods_id+'.html'" class="f-333">{{item.sku_name}}</a>
</p>
<p class="mui-col-sm-1 mui-col-xs-1 ta-c">
<a href="javascript:void(0)" v-show="item.editState"
@click="deleteGoods(item.cart_id)"
class="icon iconfont icon-shanchu delete-tier f-333"></a>
<a href="javascript:void(0)" v-show="item.editState" @click="deleteGoods(item.cart_id)" class="icon iconfont icon-shanchu delete-tier f-333"></a>
</p>
</h4>
<ul class="mui-row">
<ul class="mui-row">
<li class="mui-col-sm-8 mui-col-xs-8">
<span>制造商:</span>
<p>{{item.brand_name}}</p>
</li>
<li class="mui-col-sm-4 mui-col-xs-4 t-r huoqi">货期:{{(item.goods_type==3)?'立即发货':(item.delivery_time||'- -')}}</li>
<li class="mui-col-sm-4 mui-col-xs-4 t-r huoqi" >货期:{{item.delivery_time||'- -'}}</li>
<li class="mui-col-sm-8 mui-col-xs-8">
<span>供应商:</span>
<p>{{(item.goods_type==3)?'现货自营':(item.supplier_name||'- -')}}</p>
<p>{{item.supplier_name||'- -'}}</p>
</li>
<li class="mui-col-sm-4 mui-col-xs-4 t-r">
最小起订量:<font v-html="item.min_buy"></font>
......@@ -178,40 +160,34 @@
<li class="mui-col-sm-7 mui-col-xs-7">
标准包装量:<font v-html="item.min_mpq"></font>
</li>
<li class="mui-col-sm-5 mui-col-xs-5 danjia t-r">单价:{{item.goods_price_format}}</li>
<li class="mui-col-sm-5 mui-col-xs-5 danjia t-r" >单价:{{item.goods_price_format}}</li>
</ul>
<div class="mui-row">
<div class="mui-col-sm-7 mui-col-xs-7">
<div class="morePrice">
<div :id="'priceContent'+item.cart_id"
:class="{'lyClass':item.tiered&&item.tiered.length<4,'lyMoreData':item.tiered&&item.tiered.length>3}">
<div class="mui-row act" v-for="(itemPrice,index) in item.tiered"
:class="{'dataNo':(index>2)&&!item.priceCheck}">
<p class="mui-col-sm-3 mui-col-xs-3">
<font v-html="itemPrice.purchases"></font>+
</p>
<div
:id="'priceContent'+item.cart_id"
:class="{'lyClass':item.tiered&&item.tiered.length<4,'lyMoreData':item.tiered&&item.tiered.length>3}"
>
<div class="mui-row act" v-for="(itemPrice,index) in item.tiered"
:class="{'dataNo':(index>2)&&!item.priceCheck}">
<p class="mui-col-sm-3 mui-col-xs-3"><font v-html="itemPrice.purchases"></font>+</p>
<p class="mui-col-sm-4 mui-col-xs-4 f-red">${{itemPrice.price_us}}</p>
</div>
</div>
<div class="more-height" v-if="item.tiered&&item.tiered.length>3"
@click="priceRow(ly2Data,indexdata,item.cart_id)"
v-html="item.checkBtn||defaultBtn">更多梯度价格<i class="iconfont icon-bot"></i>
</div>
@click="priceRow(ly2Data,indexdata,item.cart_id)"
v-html="item.checkBtn||defaultBtn">更多梯度价格<i class="iconfont icon-bot"></i></div>
</div>
</div>
<div class="mui-col-sm-5 mui-col-xs-5">
<div class="clr add-num">
<div class="mui-numbox edit-input">
<button class="mui-btn mui-btn-numbox-minus " type="button"
@click="changeNumber(item.allow_presale,item.ac_type,item.goods_number,item.multiple,item.min_buy,item.stock,item.cart_id,1)">
<button class="mui-btn mui-btn-numbox-minus " type="button" @click="changeNumber(item.allow_presale,item.ac_type,item.goods_number,item.multiple,item.min_buy,item.stock,item.cart_id,1)">
<i class="icon iconfont icon-jian"></i>
</button>
<input class="mui-input-numbox valuep" type="number"
:id="'test'+item.cart_id"
@blur="changeNumber(item.allow_presale,item.ac_type,item.goods_number,item.multiple,item.min_buy,item.stock,item.cart_id,3)"
:value="item.goods_number | numberCode">
<button class="mui-btn mui-btn-numbox-plus " type="button"
@click="changeNumber(item.allow_presale,item.ac_type,item.goods_number,item.multiple,item.min_buy,item.stock,item.cart_id,2)">
<input class="mui-input-numbox valuep" type="number" :id="'test'+item.cart_id" @blur="changeNumber(item.allow_presale,item.ac_type,item.goods_number,item.multiple,item.min_buy,item.stock,item.cart_id,3)" :value="item.goods_number | numberCode">
<button class="mui-btn mui-btn-numbox-plus " type="button" @click="changeNumber(item.allow_presale,item.ac_type,item.goods_number,item.multiple,item.min_buy,item.stock,item.cart_id,2)">
<i class="icon iconfont icon-jia"></i>
</button>
</div>
......@@ -233,7 +209,7 @@
</dl>
</div>
<div class="sxData" v-for="item in ly2LoseData">
<div class="mui-row shop-block shop-lose">
<div class="mui-row shop-block shop-lose" >
<div class="mui-col-sm-1 mui-col-xs-1"></div>
<div class="mui-col-sm-11 mui-col-xs-11">
<h4 class="mui-row">
......@@ -242,13 +218,11 @@
</p>
</h4>
<ul class="mui-row">
<li class="mui-col-sm-8 mui-col-xs-8"><span>制造商:</span>
<p>{{item.brand_name}}</p>
</li>
<li class="mui-col-sm-4 mui-col-xs-4 t-r ">货期:{{(item.goods_type==3)?'立即发货':(item.delivery_time||'- -')}}</li>
<li class="mui-col-sm-8 mui-col-xs-8"><span>制造商:</span><p>{{item.brand_name}}</p></li>
<li class="mui-col-sm-4 mui-col-xs-4 t-r ">货期:{{item.delivery_time||'- -'}}</li>
<li class="mui-col-sm-8 mui-col-xs-8">
<span>供应商:</span>
<p>{{(item.goods_type==3)?'现货自营':(item.supplier_name||'- -')}}</p>
<p>{{item.supplier_name||'- -'}}</p>
</li>
<li class="mui-col-sm-4 mui-col-xs-4 t-r">
最小起订量:<font v-html="item.min_buy"></font>
......@@ -259,8 +233,7 @@
<li class="mui-col-sm-5 mui-col-xs-5 danjia t-r">单价:{{item.goods_price_format}}</li>
</ul>
<p class="lose-but">
<a :href="'/s/?k='+item.goods_name" class="fr but-bor-red muiclickbug"
guid="6436">去搜索</a>
<a :href="'/s/?k='+item.goods_name" class="fr but-bor-red muiclickbug" guid="6436">去搜索</a>
<span>已失效</span>
</p>
</div>
......@@ -270,7 +243,237 @@
</div>
</div>
<!--自营盒子-->
<div class="zyBox" v-show="type==2" :style="{'paddingTop':(paddingTop-44)+'px'}">
<!--登录提示框-->
<div class="logintip zyfixed" v-if="!isLogingo">
<span>登录后商品会同步到您账户中</span>
<a :href="loginUrl">登录</a>
</div>
<div class="dataBox">
<!--编辑-->
<div class="editBox clr zyfixed" :style="{'top':paddingTop+'px'}" v-if="!isNoContent">
<a href="javascript:void(0)" class="edit-btn fr" @click="isEditf()" v-if="isEdit">完成</a>
<a href="javascript:void(0)" class="edit-btn fr" @click="isEditf()" v-if="!isEdit">编辑</a>
</div>
<div class="zyDataGp">
<div class="xianhuoData" >
<div class="mui-row headxianhuoqihuo" v-if="zy1Data.length>0">
<div class="mui-col-sm-1 mui-col-xs-1 ta-c zdychec1">
<van-checkbox v-model="zy1DataIsCheck" @click="checkWatchZy(1)"></van-checkbox>
</div>
<div class="mui-col-sm-11 mui-col-xs-11"><font class="zyqxtype">现货商品</font></div>
</div>
<template v-for="(item,indexdata) in zy1Data">
<div class="mui-row shop-block sale_type_data" >
<div class="mui-col-sm-1 mui-col-xs-1 ta-c mt-10 zdychec">
<van-checkbox v-model="item.check" @change="checkWatch"></van-checkbox>
</div>
<div class="mui-col-sm-11 mui-col-xs-11">
<h4 class="mui-row">
<p class="mui-col-sm-11 mui-col-xs-11">
<a :href="'/item/'+item.goods_id+'.html'" class="f-333" >{{item.sku_name}}</a>
</p>
<p class="mui-col-sm-1 mui-col-xs-1 ta-c">
<a href="javascript:void(0)" guid="1991" v-show="item.editState" @click="deleteGoods(item.cart_id)" class="icon iconfont icon-shanchu delete-tier f-333"></a>
</p>
</h4>
<div class="mt-10" v-if="item.ac_type==8&&item.activity_info"><span class="hot-price">{{item.activity_info.sign_name}}</span><font class="f-red"> {{item.activity_info.activity_ad}}</font></div>
<ul class="mui-row">
<li class="mui-col-sm-8 mui-col-xs-8">
<span>制造商:</span>
<p>{{item.brand_name}}</p>
</li>
<li class="mui-col-sm-4 mui-col-xs-4 t-r ">
库存:<font v-html="item.stock"></font>
</li>
<li class="mui-col-sm-8 mui-col-xs-8">
<span style="width:37px;">型号:</span>
<p style="padding-left:0px;">{{item.goods_name||'- -'}}</p>
</li>
<li class="mui-col-sm-4 mui-col-xs-4 t-r">
最小起订量:<font v-html="item.min_buy"></font>
</li>
<li class="mui-col-sm-7 mui-col-xs-7">
倍数:<font v-html="item.mpl"></font>
</li>
<li class="mui-col-sm-5 mui-col-xs-5 danjia t-r" >
单价:{{item.goods_price_format}}
</li>
</ul>
<div class="mui-row">
<div class="mui-col-sm-7 mui-col-xs-7">
<div class="morePrice">
<div
:id="'priceContent'+item.cart_id"
:class="{'lyClass':item.tiered&&item.tiered.length<4,'lyMoreData':item.tiered&&item.tiered.length>3}"
>
<div class="mui-row act" v-for="(itemPrice,index) in item.tiered"
:class="{'dataNo':(index>2)&&!item.priceCheck}">
<p class="mui-col-sm-6 mui-col-xs-6"><font v-html="itemPrice.purchases"></font>+</p>
<p class="mui-col-sm-6 mui-col-xs-6 f-red">{{item.ac_type == 6?itemPrice.price_ac:itemPrice.price_cn}}</p>
</div>
</div>
<div class="more-height" v-if="item.tiered&&item.tiered.length>3"
@click="priceRow(zy1Data,indexdata,item.cart_id)"
v-html="item.checkBtn||defaultBtn">更多梯度价格<i class="iconfont icon-bot"></i></div>
</div>
</div>
<div class="mui-col-sm-5 mui-col-xs-5">
<div class="clr add-num">
<div class="mui-numbox edit-input">
<button class="mui-btn mui-btn-numbox-minus " type="button" @click="changeNumber(item.allow_presale,item.ac_type,item.goods_number,item.mpl,item.min_buy,item.stock,item.cart_id,1)">
<i class="icon iconfont icon-jian"></i>
</button>
<input class="mui-input-numbox valuep" type="number" :id="'test'+item.cart_id" @blur="changeNumber(item.allow_presale,item.ac_type,item.goods_number,item.mpl,item.min_buy,item.stock,item.cart_id,3)" :value="item.goods_number | numberCode">
<button class="mui-btn mui-btn-numbox-plus " type="button" @click="changeNumber(item.allow_presale,item.ac_type,item.goods_number,item.mpl,item.min_buy,item.stock,item.cart_id,2)">
<i class="icon iconfont icon-jia"></i>
</button>
</div>
</div>
<p class="subtotal f-999">
小计:<b class="f-red rewTotal">{{item.goods_amount_format}}</b>
</p>
</div>
</div>
</div>
</div>
</template>
</div>
<div class="qihuoData" >
<div class="mui-row headxianhuoqihuo" v-if="zy2Data.length>0" >
<div class="mui-col-sm-1 mui-col-xs-1 ta-c zdychec1">
<van-checkbox v-model="zy2DataIsCheck" @click="checkWatchZy(2)"></van-checkbox>
</div>
<div class="mui-col-sm-11 mui-col-xs-11"><font class="zyqxtype">期货商品</font></div>
</div>
<template v-for="(item,indexdata) in zy2Data">
<div class="mui-row shop-block sale_type_data" >
<div class="mui-col-sm-1 mui-col-xs-1 ta-c mt-10 zdychec">
<van-checkbox v-model="item.check" @change="checkWatch"></van-checkbox>
</div>
<div class="mui-col-sm-11 mui-col-xs-11">
<h4 class="mui-row">
<p class="mui-col-sm-11 mui-col-xs-11">
<a :href="'/item/'+item.goods_id+'.html'" class="f-333" >{{item.sku_name}}</a>
</p>
<p class="mui-col-sm-1 mui-col-xs-1 ta-c">
<a href="javascript:void(0)" v-show="item.editState" @click="deleteGoods(item.cart_id)" class="icon iconfont icon-shanchu delete-tier f-333"></a>
</p>
</h4>
<div class="mt-10" v-if="item.ac_type==8&&item.activity_info"><span class="hot-price">{{item.activity_info.sign_name}}</span><font class="f-red"> {{item.activity_info.activity_ad}}</font></div>
<ul class="mui-row">
<li class="mui-col-sm-8 mui-col-xs-8">
<span>制造商:</span>
<p>{{item.brand_name}}</p>
</li>
<li class="mui-col-sm-4 mui-col-xs-4 t-r ">
库存:<font v-html="item.stock"></font>
</li>
<li class="mui-col-sm-8 mui-col-xs-8">
<span style="width:37px;">型号:</span>
<p style="padding-left:0px;">{{item.goods_name||'- -'}}</p>
</li>
<li class="mui-col-sm-4 mui-col-xs-4 t-r">
最小起订量:<font v-html="item.min_buy"></font>
</li>
<li class="mui-col-sm-7 mui-col-xs-7">
倍数:<font v-html="item.mpl"></font>
</li>
<li class="mui-col-sm-5 mui-col-xs-5 danjia t-r" >
单价:{{item.goods_price_format}}
</li>
</ul>
<div class="mui-row">
<div class="mui-col-sm-7 mui-col-xs-7">
<div class="morePrice">
<div
:id="'priceContent'+item.cart_id"
:class="{'lyClass':item.tiered&&item.tiered.length<4,'lyMoreData':item.tiered&&item.tiered.length>3}"
>
<div class="mui-row act" v-for="(itemPrice,index) in item.tiered"
:class="{'dataNo':(index>2)&&!item.priceCheck}">
<p class="mui-col-sm-6 mui-col-xs-6"><font v-html="itemPrice.purchases"></font>+</p>
<p class="mui-col-sm-6 mui-col-xs-6 f-red">{{item.ac_type == 6?itemPrice.price_ac:itemPrice.price_cn}}</p>
</div>
</div>
<div class="more-height" v-if="item.tiered&&item.tiered.length>3"
@click="priceRow(zy2Data,indexdata,item.cart_id)"
v-html="item.checkBtn||defaultBtn">更多梯度价格<i class="iconfont icon-bot"></i></div>
</div>
</div>
<div class="mui-col-sm-5 mui-col-xs-5">
<div class="clr add-num">
<div class="mui-numbox edit-input">
<button class="mui-btn mui-btn-numbox-minus " type="button" @click="changeNumber(item.allow_presale,item.ac_type,item.goods_number,item.mpl,item.min_buy,item.stock,item.cart_id,1)">
<i class="icon iconfont icon-jian"></i>
</button>
<input class="mui-input-numbox valuep" type="number" :id="'test'+item.cart_id" @blur="changeNumber(item.allow_presale,item.ac_type,item.goods_number,item.mpl,item.min_buy,item.stock,item.cart_id,3)" :value="item.goods_number | numberCode">
<button class="mui-btn mui-btn-numbox-plus " type="button" @click="changeNumber(item.allow_presale,item.ac_type,item.goods_number,item.mpl,item.min_buy,item.stock,item.cart_id,2)">
<i class="icon iconfont icon-jia"></i>
</button>
</div>
</div>
<p class="subtotal f-999">
小计:<b class="f-red rewTotal">{{item.goods_amount_format}}</b>
</p>
</div>
</div>
</div>
</div>
</template>
</div>
<div class="shopcart content-no" v-if="isNoContent">
<dl class="shop-empty">
<dt><i class="iconfont icon-gouwuche1"></i></dt>
<dd>
<h4>您的购物车空空如也</h4>
<p><a class="muiclickbug" href="/v3/search/search_index.html">搜索型号 &gt;&gt;</a></p>
</dd>
</dl>
</div>
<div class="sxData" v-for="item in zy1LoseData">
<div class="mui-row shop-block shop-lose" >
<div class="mui-col-sm-1 mui-col-xs-1"></div>
<div class="mui-col-sm-11 mui-col-xs-11">
<h4 class="mui-row">
<p class="mui-col-sm-11 mui-col-xs-11">
<a href="javascript:void(0)">{{item.sku_name}}</a>
</p>
</h4>
<div class="mt-10" v-if="item.ac_type==8&&item.activity_info"><span class="hot-price">{{item.activity_info.sign_name}}</span><font class="f-red"> {{item.activity_info.activity_ad}}</font></div>
<ul class="mui-row">
<li class="mui-col-sm-8 mui-col-xs-8"><span>制造商:</span><p>{{item.brand_name}}</p></li>
<li class="mui-col-sm-4 mui-col-xs-4 t-r huoqi" >货期:{{item.delivery_time||'- -'}}</li>
<li class="mui-col-sm-8 mui-col-xs-8">
<span>供应商:</span>
<p>{{item.supplier_name||'- -'}}</p>
</li>
<li class="mui-col-sm-4 mui-col-xs-4 t-r">
最小起订量:<font v-html="item.min_buy"></font>
</li>
<li class="mui-col-sm-7 mui-col-xs-7">
标准包装量:<font v-html="item.min_mpq"></font>
</li>
<li class="mui-col-sm-5 mui-col-xs-5 danjia t-r">单价:{{item.goods_price_format}}</li>
</ul>
<p class="lose-but">
<a :href="'/s/?k='+item.goods_name" class="fr but-bor-red muiclickbug" guid="6436">去搜索</a>
<span>已失效</span>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!--购物车底部-->
<div class="mui-row shop-but" v-if="!isNoContent">
<div class="mui-col-sm-3 mui-col-xs-3 checkallbox">
......@@ -281,159 +484,188 @@
<p class="f-999">(不含运费)</p>
</div>
<div class="mui-col-sm-3 mui-col-xs-3 button" :class="{'dis':(totalNum==0)}" v-if="!isEdit">
<a href="javascript:void('0')" class="but-red" @click="goSubmit">去结算<span>(<span
class="carNum">{{totalNum}}</span>)</span></a>
<a href="javascript:void('0')" class="but-red" @click="goSubmit">去结算<span>(<span class="carNum">{{totalNum}}</span>)</span></a>
</div>
<div class="mui-col-sm-9 mui-col-xs-9 button " v-if="isEdit">
<a href="javascript:void(0)" class="but-orange fr delbtn" @click="deleteGoods(0)">删除</a>
<span class="f-blue fr clearbtn" @click="deleteGoods(0,1)">清除失效商品</span>
</div>
</div>
<Header :meaushow="meaushow" :bgcolor="bgcolor" :title="title"></Header>
<van-loading type="spinner" color="#000" class="loading-background" v-if="loading" />
<Header :isCar="isCar" :ly1Length="ly1Length" :ly2Length="ly2Length" :zy1Length="zy1Length" :meaushow="meaushow" :bgcolor="bgcolor" @listTab="listTab"></Header>
<van-loading type="spinner" color="#000" class="loading-background" v-if="loading"/>
</div>
</template>
<script>
import Vue from 'vue';
import {
mapState
} from 'vuex'
import {mapState} from 'vuex'
import Header from "@/views/common/Header.vue";
import {
Loading,
Toast,
Checkbox,
Dialog
} from 'vant';
import {Loading,Toast,Checkbox,Dialog} from 'vant';
import Util from "../../util";
Vue.use(Loading).use(Toast).use(Checkbox).use(Dialog);
export default {
name: "car",
data() {
data(){
return {
title: "购物车",
meaushow: true,
bgcolor: "#fff",
isCar:true,
meaushow:true,
bgcolor:"#fff",
defaultBtn: '更多梯度价格<i class="icon-bot"></i>',
loginUrl: '/v3/login?referer=' + encodeURIComponent(window.location.href), //登录地址
delivery: 1, //大陆1 //香港2,
paddingTop: 88, //控制登录提示条
isEdit: false, //是否是编辑状态
isLogingo: Util.isLogin() == 1 ? true : false, //强登录太
isAll: true, //商品全部选中
totalMoney: 0, //总金额
totalNum: 0, //总数量
isNoContent: false, //没有数据展示
loginUrl:'/v3/login?referer='+encodeURIComponent(window.location.href),//登录地址
type:1,//联营 1 //自营2
delivery:1,//大陆1 //香港2,
paddingTop:88,//控制登录提示条
isEdit:false,//是否是编辑状态
isLogingo:Util.isLogin()==1?true:false,//强登录太
zy1DataIsCheck:true,//现货全部选中状态
zy2DataIsCheck:false,//期货全部选中状态
isAll:true,//商品全部选中
totalMoney:0,//总金额
totalNum:0,//总数量
isNoContent:false,//没有数据展示
}
},
computed: {
computed:{
...mapState({
loading: state => state.car.loading,
loading1: state => state.car.loading1,
ly1: state => state.car.ly1,
ly2: state => state.car.ly2,
zy1: state => state.car.zy1,
ly1Data: state => state.car.ly1Data,
ly2Data: state => state.car.ly2Data,
zy1Data: state => state.car.zy1Data,
zy2Data: state => state.car.zy2Data,
ly1Length: state => state.car.ly1Length,
ly2Length: state => state.car.ly2Length,
zy1Length: state => state.car.zy1Length,
ly1LoseData: state => state.car.ly1LoseData,
ly2LoseData: state => state.car.ly2LoseData,
zy1LoseData: state => state.car.zy1LoseData,
totlaMState: state => state.car.totlaMState,
})
},
created() {
created(){
this.loginTip();
this.getCarCount();
this.getData();
this.priceInit();
},
watch: {
totlaMState(val) {
if (val) {
watch:{
totlaMState(val){
if(val){
this.priceInit();
}
},
loading1(val) {
this.isNoContent = false;
if (!val) {
loading1(val){
this.isNoContent=false;
if(!val){
this.priceInit();
this.isNOD();
}
},
isEdit(val) {
var list_1 = this.ly1Data,
list_2 = this.ly2Data
for (var i = 0; i < list_1.length; i++) {
list_1[i].editState = val;
isEdit(val){
var list_1=this.ly1Data,list_2=this.ly2Data,list_3=this.zy1Data,list_4=this.zy2Data
for(var i=0;i<list_1.length;i++){
list_1[i].editState=val;
}
for(var i=0;i<list_2.length;i++){
list_2[i].editState=val;
}
for(var i=0;i<list_3.length;i++){
list_3[i].editState=val;
}
for(var i=0;i<list_4.length;i++){
list_4[i].editState=val;
}
for (var i = 0; i < list_2.length; i++) {
list_2[i].editState = val;
},
ly1Data(val){
this.priceInit();
if(val.length==0){
this.isNOD();
}
},
ly2Data(val){
this.priceInit();
if(val.length==0){
this.isNOD();
}
},
ly1Data(val) {
zy1Data(val){
this.priceInit();
if (val.length == 0) {
this.checkWatch();
if(val.length==0){
this.isNOD();
}
},
ly2Data(val) {
zy2Data(val){
this.priceInit();
if (val.length == 0) {
this.checkWatch();
if(val.length==0){
this.isNOD();
}
},
ly1LoseData(val) {
if (val.length == 0) {
ly1LoseData(val){
if(val.length==0){
this.isNOD();
}
},
ly2LoseData(val) {
if (val.length == 0) {
ly2LoseData(val){
if(val.length==0){
this.isNOD();
}
},
zy1LoseData(val){
if(val.length==0){
this.isNOD();
}
},
},
methods: {
isNOD: function () {
methods:{
isNOD:function(){
//没数据展示
//联营
if (this.delivery == 1) {
//大陆
if (this.ly1Data.length == 0 && this.ly1LoseData.length == 0) {
this.isNoContent = true;
} else {
this.isNoContent = false;
if(this.type==1){
//联营
if(this.delivery==1){
//大陆
if(this.ly1Data.length==0&&this.ly1LoseData.length==0){
this.isNoContent=true;
}else{
this.isNoContent=false;
}
}else{
//香港
if(this.ly2Data.length==0&&this.ly2LoseData.length==0){
this.isNoContent=true;
}else{
this.isNoContent=false;
}
}
} else {
//香港
if (this.ly2Data.length == 0 && this.ly2LoseData.length == 0) {
this.isNoContent = true;
} else {
this.isNoContent = false;
}else{
//自营
if(this.zy1Data.length==0&&this.zy2Data.length==0&&this.zy1LoseData.length==0){
this.isNoContent=true;
}else{
this.isNoContent=false;
}
}
},
//是否登录UI
loginTip: function () {
if (this.isLogingo) {
this.paddingTop = 44;
} else {
this.paddingTop = 88;
}
loginTip:function(){
if(this.isLogingo){
this.paddingTop=44;
}else{
this.paddingTop=88;
}
},
//友情提示
tipLy: function () {
tipLy:function(){
Dialog.alert({
messageAlign: "left",
messageAlign:"left",
title: '友情提醒',
message: '<div class="remind-content">\n' +
'1.国际运费补差情况<br>' +
......@@ -458,33 +690,58 @@
});
},
//自营联营切换
listTab:function(type){
this.type=type;
this.checkWatch();
this.priceInit();
this.isNOD();
this.isEdit=false;
if(type==2&&this.zy1){
return
}
if(type==1){
if(this.delivery==1&&this.ly1){
return
}
if(this.delivery==2&&this.ly2){
return
}
}
this.getData();
},
//获取数据
getData: function () {
getData:function(){
this.$store.dispatch({
type: 'cartList',
delivery_place: this.delivery
delivery_place:this.delivery,
order_goods_type: this.type
})
},
//获取购物车数量
getCarCount:function(){
this.$store.dispatch({
type: 'allcount'
})
},
//大陆香港切换
deliveryTab: function (delivery) {
this.delivery = delivery;
deliveryTab:function(delivery){
this.delivery=delivery;
this.checkWatch();
this.priceInit();
this.isNOD();
this.isEdit = false;
if (this.delivery == 1 && this.ly1) {
this.isEdit=false;
if(this.delivery==1&&this.ly1){
return
}
if (this.delivery == 2 && this.ly2) {
if(this.delivery==2&&this.ly2){
return
}
this.getData();
},
//阶梯价格处理
priceRow: function (dataList, index, id) {
priceRow: function(dataList,index,id) {
let dom = document.getElementById("priceContent" + id);
let arrLength = dataList[index].tiered.length;
if (dataList[index]["priceCheck"]) {
......@@ -511,88 +768,183 @@
}
},
//编辑
isEditf: function () {
this.isEdit = !this.isEdit;
isEditf:function(){
this.isEdit=!this.isEdit;
},
//基础复选框
checkWatch: function () {
var self = this;
//联营
var list_ = self.delivery == 1 ? this.ly1Data : this.ly2Data;
self.isAll = true;
for (var i = 0; i < list_.length; i++) {
if (!list_[i].check) {
self.isAll = false;
checkWatch:function(){
var self=this;
if(self.type==1){
//联营
var list_=self.delivery==1?this.ly1Data:this.ly2Data;
self.isAll=true;
for(var i=0;i<list_.length;i++){
if(!list_[i].check){
self.isAll=false;
}
}
}else{
self.isAll=true;
//自营
var list_1=this.zy1Data;
self.zy1DataIsCheck=true;
for(var i=0;i<list_1.length;i++){
if(!list_1[i].check){
self.zy1DataIsCheck=false;
self.isAll=false;
}
}
var list_2=this.zy2Data;
self.zy2DataIsCheck=true;
for(var j=0;j<list_2.length;j++){
if(!list_2[j].check){
self.zy2DataIsCheck=false;
self.isAll=false;
}
}
}
this.priceInit();
},
//全选
checkAll: function () {
var self = this;
//联营
var list_ = self.delivery == 1 ? this.ly1Data : this.ly2Data;
if (list_.length <= 0) {
return
//期货现货复选框
checkWatchZy:function(tp){
var self=this;
var list_1=this.zy1Data;
var list_2=this.zy2Data;
if(tp==1){
//现货
for(var i=0;i<list_1.length;i++){
if(!self.zy1DataIsCheck){
list_1[i].check=true;
}else{
list_1[i].check=false;
}
}
}else{
//期货
for(var i=0;i<list_2.length;i++){
if(!self.zy2DataIsCheck){
list_2[i].check=true;
}else{
list_2[i].check=false;
}
}
}
for (var i = 0; i < list_.length; i++) {
if (self.isAll) {
list_[i].check = true;
} else {
list_[i].check = false;
this.priceInit();
},
//全选
checkAll:function(){
var self=this;
if(self.type==1){
//联营
var list_=self.delivery==1?this.ly1Data:this.ly2Data;
if(list_.length<=0){return}
for(var i=0;i<list_.length;i++){
if(!self.isAll){
list_[i].check=true;
}else{
list_[i].check=false;
}
}
}else{
//自营
var list_1=this.zy1Data;
var list_2=this.zy2Data;
if(!self.isAll){
self.zy1DataIsCheck=true;
self.zy2DataIsCheck=true;
for(var i=0;i<list_1.length;i++){
list_1[i].check=true;
}
for(var i=0;i<list_2.length;i++){
list_2[i].check=true;
}
}else{
self.zy1DataIsCheck=false;
self.zy2DataIsCheck=false;
for(var i=0;i<list_1.length;i++){
list_1[i].check=false;
}
for(var i=0;i<list_2.length;i++){
list_2[i].check=false;
}
}
}
this.priceInit();
},
//渲染价格
priceInit: function () {
//联营
var list_ = this.delivery == 1 ? this.ly1Data : this.ly2Data,
num = 0,
totalnum = 0;
for (var i = 0; i < list_.length; i++) {
if (list_[i].check) {
num += Number(Number((list_[i].goods_amount_format).slice(1)).toFixed(4));
priceInit:function(){
if(this.type==1){
//联营
var list_=this.delivery==1?this.ly1Data:this.ly2Data,num=0,totalnum=0;
for(var i=0;i<list_.length;i++){
if(list_[i].check){
num+=Number(Number((list_[i].goods_amount_format).slice(1)).toFixed(4));
totalnum++;
}
}
this.totalNum=totalnum;
this.totalMoney=(this.delivery==1?"¥":"$")+num.toFixed(4);
}else{
//自营
var list_1=this.zy1Data,list_2=this.zy2Data,num=0,totalnum=0;
for(var i=0;i<list_1.length;i++){
if(list_1[i].check){
num+=Number(Number((list_1[i].goods_amount_format).slice(1)).toFixed(4));
totalnum++;
}
}
for(var i=0;i<list_2.length;i++){
if(list_2[i].check){
num+=Number(Number((list_2[i].goods_amount_format).slice(1)).toFixed(4));
totalnum++;
}
}
this.totalNum = totalnum;
this.totalMoney = (this.delivery == 1 ? "¥" : "$") + num.toFixed(4);
this.totalNum=totalnum;
this.totalMoney="¥"+num.toFixed(4);
}
},
//删除
deleteGoods: function (arr, act) {
var cart_id, self = this;
var act = act ? 'faild' : 'normal';
if (act == 'normal') {
deleteGoods:function(arr,act){
var cart_id,self=this;
var act=act?'faild':'normal';
if(act=='normal'){
//删除
if (arr == 0) {
if(arr==0){
//多个删除逻辑
var arrp = this.getIDs();
cart_id = arrp.join(",");
} else {
var arrp=this.getIDs();
cart_id=arrp.join(",");
}else{
//单个删除
cart_id = arr;
cart_id=arr;
}
if (cart_id == "") {
if(cart_id==""){
Toast({
message: "请选中至少一个商品",
duration: 1500
});
return;
}
} else {
}else{
//清除
var arrp = [];
var list_ = self.delivery == 1 ? this.ly1LoseData : this.ly2LoseData;
for (var i = 0; i < list_.length; i++) {
var arrp=[];
if(self.type==1){
var list_=self.delivery==1?this.ly1LoseData:this.ly2LoseData;
for(var i=0;i<list_.length;i++){
arrp.push(list_[i].cart_id)
}
}else{
var list_=this.zy1LoseData;
for(var i=0;i<list_.length;i++){
arrp.push(list_[i].cart_id)
}
cart_id = arrp.join(",");
if (cart_id == "") {
}
cart_id=arrp.join(",");
if(cart_id==""){
Toast({
message: "当前没有要清除的商品",
duration: 1500
......@@ -602,16 +954,16 @@
}
Dialog.confirm({
message: '您确定要' + (act ? '清除' : '删除') + '当前商品吗',
cancelButtonText: '再看看'
message: '您确定要'+(act?'清除':'删除')+'当前商品吗',
cancelButtonText:'再看看'
}).then(() => {
self.$store.dispatch({
type: 'cartDelete',
cart_id: cart_id,
cart_id:cart_id,
act: act,
types: self.type,
delivery: self.delivery
types:self.type,
delivery:self.delivery
})
}).catch(() => {
......@@ -620,144 +972,188 @@
},
//获取当前选中ID数组f
getIDs: function () {
var self = this;
var arrp = [];
var list_ = self.delivery == 1 ? this.ly1Data : this.ly2Data;
for (var i = 0; i < list_.length; i++) {
if (list_[i].check) {
arrp.push(list_[i].cart_id)
getIDs:function(){
var self=this;
var arrp=[];
if(this.type==1){
var list_=self.delivery==1?this.ly1Data:this.ly2Data;
for(var i=0;i<list_.length;i++){
if(list_[i].check){
arrp.push(list_[i].cart_id)
}
}
}else{
//自营
var list_1=this.zy1Data,list_2=this.zy2Data;
if(list_1.length>0){
for(var i=0;i<list_1.length;i++){
if(list_1[i].check){
arrp.push(list_1[i].cart_id)
}
}
}
if(list_2.length>0){
for(var l=0;l<list_2.length;l++){
if(list_2[l].check){
arrp.push(list_2[l].cart_id)
}
}
}
}
return arrp;
},
//结算提交
goSubmit: function () {
goSubmit:function(){
var self = this;
var arrp = self.getIDs();
if (arrp.length == 0) {
var self=this;
var arrp=self.getIDs();
if(arrp.length==0){
Toast({
message: "当前没有选中商品",
duration: 1500
});
return;
}
if(self.type==2){
var arr1 = self.zy1Data,arr2=self.zy2Data,arr3=[];
for(var i=0;i<arrp.length;i++){
var indeval=arrp[i];
for(var p=0;p<arr1.length;p++){
if(indeval==arr1[p].cart_id){
arr3.push(arr1[p].sale_type)
}
}
for(var j=0;j<arr2.length;j++){
if(indeval==arr2[j].cart_id){
arr3.push(arr2[j].sale_type)
}
}
}
if(arr3.indexOf('1')!=-1 && arr3.indexOf('2')!=-1){
Toast({
message: "请分开结算期货订单和现货订单",
duration: 1500
});
return;
}
var confirm_ = window.location.origin + "/v3/order/confirm"
window.sessionStorage.setItem("car_xk", arrp.join(","));
}
var confirm_=(self.type==2)?window.location.origin+"/v3/order/confirm?type=zy":window.location.origin+"/v3/order/confirm?type=other"
window.sessionStorage.setItem("car_xk",arrp.join(","));
self.$store.dispatch({
type: 'confirmBehavior',
url_: confirm_
url_:confirm_
})
},
changeNumber: function (allowPresale, goodType, number, mpq, min, stock, cart_id, type) {
var self = this;
var num = Util.aggxde(number),
mpq = Util.aggxde(mpq), //包装数或者倍数
min = Util.aggxde(min), //最小购买数量
stock = Util.aggxde(stock), //最大购买数量
summitNum = num;
if (min > mpq) {
if (min % mpq) {
min = Math.ceil(min / mpq) * mpq;
changeNumber:function(allowPresale,goodType,number,mpq,min,stock,cart_id,type){
var self=this;
var num=Util.aggxde(number),
mpq=Util.aggxde(mpq),//包装数或者倍数
min=Util.aggxde(min),//最小购买数量
stock=Util.aggxde(stock),//最大购买数量
summitNum=num;
if(min>mpq){
if(min%mpq){
min=Math.ceil(min/mpq)*mpq;
}
} else {
min = mpq;
}else{
min=mpq;
}
if (stock % mpq) {
stock = Math.floor(stock / mpq) * mpq;
if(stock%mpq){
stock=Math.floor(stock/mpq)*mpq;
}
if (type == 1) {
if(type==1){
//减小
summitNum = summitNum - mpq;
if (summitNum < min) {
summitNum = min;
summitNum=summitNum-mpq;
if(summitNum<min){
summitNum=min;
Toast({
message: "购买数量不能小于最小购买数量!",
duration: 1500
});
return;
}
} else if (type == 2) {
}else if(type==2){
//增加
summitNum = summitNum + mpq;
if (summitNum > stock) {
if (self.type == 1) {
summitNum = stock;
summitNum=summitNum+mpq;
if(summitNum>stock){
if(self.type==1){
summitNum=stock;
Toast({
message: "购买数量不能大于最大购买数量!",
duration: 1500
});
return;
} else if (self.type == 2) {
if (goodType == 6 && allowPresale == 1) {
self.$toast("想要购买更多,请联系客服");
var inputVal = num || 0;
if (inputVal !== 0 || inputVal !== mpq) {
summitNum = Math.floor(stock / mpq) * mpq
} else {
summitNum = inputVal
}
return
}
}else if(self.type == 2){
if(goodType == 6 && allowPresale == 1){
self.$toast("想要购买更多,请联系客服");
var inputVal = num||0;
if(inputVal!==0||inputVal!==mpq){
summitNum = Math.floor(stock/mpq)*mpq
}else{
summitNum = inputVal
}
return
}
}
}
} else {
}else{
//失去焦点改变
var thisNum = Number(document.getElementById('test' + cart_id).value);
summitNum = Math.ceil(thisNum / mpq) * mpq;
document.getElementById('test' + cart_id).value = summitNum;
if (summitNum < min) {
summitNum = min;
var thisNum=Number(document.getElementById('test'+cart_id).value);
summitNum=Math.ceil(thisNum/mpq)*mpq;
document.getElementById('test'+cart_id).value=summitNum;
if(summitNum<min){
summitNum=min;
Toast({
message: "购买数量不能小于最小购买数量!",
duration: 1500
});
document.getElementById('test' + cart_id).value = summitNum;
document.getElementById('test'+cart_id).value=summitNum;
return;
}
if (summitNum > stock) {
if (self.type == 1) {
summitNum = stock;
if(summitNum>stock){
if(self.type==1){
summitNum=stock;
Toast({
message: "购买数量不能大于最大购买数量!",
duration: 1500
});
} else if (self.type == 2) {
if (goodType == 6 && allowPresale == 1) {
self.$toast("想要购买更多,请联系客服");
var inputVal = num || 0;
if (inputVal !== 0 || inputVal !== mpq) {
summitNum = Math.floor(stock / mpq) * mpq
} else {
summitNum = inputVal
}
}else if(self.type==2){
if(goodType == 6 && allowPresale == 1){
self.$toast("想要购买更多,请联系客服");
var inputVal = num||0;
if(inputVal!==0||inputVal!==mpq){
summitNum = Math.floor(stock/mpq)*mpq
}else{
summitNum = inputVal
}
}
console.log(inputVal)
console.log(inputVal)
}
document.getElementById('test' + cart_id).value = summitNum;
document.getElementById('test'+cart_id).value=summitNum;
return;
}
}
this.$store.dispatch({
type: 'changenum',
cart_id: cart_id,
cart_id:cart_id,
num: summitNum,
delivery_place: (self.type == 1) ? self.delivery : "",
types: type
delivery_place:(self.type==1)?self.delivery:"",
types:type
})
}
},
components: {
components:{
Header
}
}
......
This diff could not be displayed because it is too large.
......@@ -4314,7 +4314,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es6_number_constructor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.number.constructor */ \"./node_modules/_core-js@2.6.11@core-js/modules/es6.number.constructor.js\");\n/* harmony import */ var core_js_modules_es6_number_constructor__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_number_constructor__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es6_regexp_split__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es6.regexp.split */ \"./node_modules/_core-js@2.6.11@core-js/modules/es6.regexp.split.js\");\n/* harmony import */ var core_js_modules_es6_regexp_split__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_split__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! vue */ \"./node_modules/_vue@2.6.11@vue/dist/vue.runtime.esm.js\");\n/* harmony import */ var vant__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! vant */ \"./node_modules/_vant@2.9.3@vant/es/index.js\");\n/* harmony import */ var _api_index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../api/index */ \"./src/api/index.js\");\n\n\n\n\n\nvue__WEBPACK_IMPORTED_MODULE_2__[\"default\"].use(vant__WEBPACK_IMPORTED_MODULE_3__[\"Toast\"]);\n\nvar qs = __webpack_require__(/*! qs */ \"./node_modules/_qs@6.9.4@qs/lib/index.js\");\n\nvar state = {\n loading: false,\n loading1: false,\n ly1: false,\n //联营大陆得到数据防止切换多次请求\n ly2: false,\n //联营香港得到数据防止切换多次请求\n ly1Data: [],\n //大陆数据\n ly2Data: [],\n //香港数据\n ly1Length: 0,\n ly2Length: 0,\n ly1LoseData: [],\n ly2LoseData: [],\n priceInit: false,\n totlaMState: false\n};\nvar mutations = {\n cartList: function cartList(state, payload) {\n state.ly1Length = payload.data.cn_count;\n state.ly2Length = payload.data.hk_count;\n\n if (payload.types_ == 1) {\n //大陆\n var arr_ = payload.data.list;\n\n for (var i = 0; i < arr_.length; i++) {\n arr_[i].editState = false;\n arr_[i].check = true;\n\n if (arr_[i].status == -1) {\n state.ly1LoseData.push(arr_[i]);\n } else {\n state.ly1Data.push(arr_[i]);\n }\n }\n } else if (payload.types_ == 2) {\n //香港\n var arr_ = payload.data.list;\n\n for (var i = 0; i < arr_.length; i++) {\n arr_[i].editState = false;\n arr_[i].check = true;\n\n if (arr_[i].status == -1) {\n state.ly2LoseData.push(arr_[i]);\n } else {\n state.ly2Data.push(arr_[i]);\n }\n }\n }\n },\n cartDelete: function cartDelete(state, payload) {\n var ids = payload.cart_id.split(\",\"); //联营\n\n if (payload.act == 'normal') {\n //删除操作\n var datalistp = payload.delivery == 1 ? state.ly1Data : state.ly2Data;\n\n for (var i = 0; i < datalistp.length; i++) {\n for (var j = 0; j < ids.length; j++) {\n if (datalistp[i].cart_id == ids[j]) {\n datalistp.splice(i, 1);\n }\n }\n }\n\n if (payload.delivery == 1) {\n state.ly1Data = datalistp;\n state.ly1Length = Number(state.ly1Length) - ids.length;\n } else {\n state.ly2Data = datalistp;\n state.ly2Length = Number(state.ly2Length) - ids.length;\n }\n } else {\n //清除过期数据\n if (payload.delivery == 1) {\n state.ly1LoseData = [];\n } else {\n state.ly2LoseData = [];\n }\n }\n },\n changenum: function changenum(state, payload) {\n //大陆//香港\n var list_ = payload.delivery_place == 1 ? state.ly1Data : state.ly2Data;\n\n for (var i = 0; i < list_.length; i++) {\n if (list_[i].cart_id == payload.cart_id) {\n list_[i].goods_number = payload.data.num;\n list_[i].goods_amount = payload.data.goods_amount;\n list_[i].goods_amount_format = payload.data.goods_amount_format;\n list_[i].goods_price = payload.data.goods_price;\n list_[i].goods_price_format = payload.data.goods_price_format;\n }\n }\n\n state.totlaMState = true;\n }\n};\nvar actions = {\n cartList: function cartList(_ref, payload) {\n var commit = _ref.commit;\n state.loading = true;\n state.loading1 = true;\n var params = {\n delivery_place: payload.delivery_place,\n order_goods_type: payload.order_goods_type\n };\n var types_;\n\n if (payload.order_goods_type == 2) {\n types_ = 3;\n } else {\n types_ = payload.delivery_place;\n }\n\n _api_index__WEBPACK_IMPORTED_MODULE_4__[\"services\"].cartList(qs.stringify(params)).then(function (res) {\n state.loading = false;\n state.loading1 = false;\n var data = res.data;\n\n if (types_ == 1) {\n //大陆\n state.ly1 = true;\n } else if (types_ == 2) {\n //香港\n state.ly2 = true;\n }\n\n if (data.err_code == 0) {\n commit({\n type: 'cartList',\n data: data.data,\n types_: types_\n });\n } else {// Toast({\n // message: data.err_msg,\n // duration: 3000\n // });\n }\n }).catch(function (err) {\n state.loading = false;\n state.loading1 = false;\n });\n },\n cartDelete: function cartDelete(_ref2, payload) {\n var commit = _ref2.commit;\n state.loading = true;\n var params = {\n cart_id: payload.cart_id,\n act: payload.act\n };\n _api_index__WEBPACK_IMPORTED_MODULE_4__[\"services\"].cartDelete(qs.stringify(params)).then(function (res) {\n state.loading = false;\n var data = res.data;\n\n if (data.err_code == 0) {\n commit({\n type: 'cartDelete',\n data: data.data,\n act: payload.act,\n cart_id: payload.cart_id,\n types: payload.types,\n delivery: payload.delivery\n });\n } else {\n Object(vant__WEBPACK_IMPORTED_MODULE_3__[\"Toast\"])({\n message: data.err_msg,\n duration: 3000\n });\n }\n }).catch(function (err) {\n state.loading = false;\n });\n },\n confirmBehavior: function confirmBehavior(_ref3, payload) {\n var commit = _ref3.commit;\n state.loading = true;\n _api_index__WEBPACK_IMPORTED_MODULE_4__[\"services\"].confirmBehavior().then(function (res) {\n state.loading = false;\n window.location.href = payload.url_;\n }).catch(function (err) {\n state.loading = false;\n });\n },\n changenum: function changenum(_ref4, payload) {\n var commit = _ref4.commit;\n\n if (payload.types == 1 || payload.types == 2) {\n state.loading = true;\n }\n\n var params = {\n cart_id: payload.cart_id,\n num: payload.num,\n delivery_place: payload.delivery_place\n };\n state.totlaMState = false;\n _api_index__WEBPACK_IMPORTED_MODULE_4__[\"services\"].changenum(qs.stringify(params)).then(function (res) {\n state.loading = false;\n var data = res.data;\n\n if (data.err_code == 0) {\n commit({\n type: 'changenum',\n data: data.data,\n cart_id: payload.cart_id,\n delivery_place: payload.delivery_place\n });\n } else {\n Object(vant__WEBPACK_IMPORTED_MODULE_3__[\"Toast\"])({\n message: data.err_msg,\n duration: 3000\n });\n }\n }).catch(function (err) {\n state.loading = false;\n });\n }\n};\nvar getters = {};\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n state: state,\n mutations: mutations,\n actions: actions,\n getters: getters\n});\n\n//# sourceURL=webpack:///./src/store/modules/car/index.js?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var core_js_modules_es6_number_constructor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.number.constructor */ \"./node_modules/_core-js@2.6.11@core-js/modules/es6.number.constructor.js\");\n/* harmony import */ var core_js_modules_es6_number_constructor__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_number_constructor__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es6_regexp_split__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es6.regexp.split */ \"./node_modules/_core-js@2.6.11@core-js/modules/es6.regexp.split.js\");\n/* harmony import */ var core_js_modules_es6_regexp_split__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_split__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! vue */ \"./node_modules/_vue@2.6.11@vue/dist/vue.runtime.esm.js\");\n/* harmony import */ var vant__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! vant */ \"./node_modules/_vant@2.9.3@vant/es/index.js\");\n/* harmony import */ var _api_index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../api/index */ \"./src/api/index.js\");\n\n\n\n\n\nvue__WEBPACK_IMPORTED_MODULE_2__[\"default\"].use(vant__WEBPACK_IMPORTED_MODULE_3__[\"Toast\"]);\n\nvar qs = __webpack_require__(/*! qs */ \"./node_modules/_qs@6.9.4@qs/lib/index.js\");\n\nvar state = {\n loading: false,\n loading1: false,\n ly1: false,\n //联营大陆得到数据防止切换多次请求\n ly2: false,\n //联营香港得到数据防止切换多次请求\n zy1: false,\n //自营得到数据防止切换多次请求\n ly1Data: [],\n //大陆数据\n ly2Data: [],\n //香港数据\n zy1Data: [],\n //自营数据现货\n zy2Data: [],\n //自营数据期货\n ly1Length: 0,\n ly2Length: 0,\n zy1Length: 0,\n //自营数据总长度\n ly1LoseData: [],\n ly2LoseData: [],\n zy1LoseData: [],\n priceInit: false,\n totlaMState: false\n};\nvar mutations = {\n cartList: function cartList(state, payload) {\n if (payload.types_ == 1) {\n //大陆\n var arr_ = payload.data.list;\n\n for (var i = 0; i < arr_.length; i++) {\n arr_[i].editState = false;\n arr_[i].check = true;\n\n if (arr_[i].status == -1) {\n state.ly1LoseData.push(arr_[i]);\n } else {\n state.ly1Data.push(arr_[i]);\n }\n }\n } else if (payload.types_ == 2) {\n //香港\n var arr_ = payload.data.list;\n\n for (var i = 0; i < arr_.length; i++) {\n arr_[i].editState = false;\n arr_[i].check = true;\n\n if (arr_[i].status == -1) {\n state.ly2LoseData.push(arr_[i]);\n } else {\n state.ly2Data.push(arr_[i]);\n }\n }\n } else {\n //自营\n var arr_ = payload.data.list;\n\n for (var i = 0; i < arr_.length; i++) {\n arr_[i].editState = false;\n\n if (arr_[i].status == -1) {\n state.zy1LoseData.push(arr_[i]);\n } else {\n if (arr_[i].sale_type == 1) {\n //现货默认勾选\n arr_[i].check = true;\n state.zy1Data.push(arr_[i]);\n } else {\n //期货 //默认不勾选\n arr_[i].check = false;\n state.zy2Data.push(arr_[i]);\n }\n }\n }\n }\n },\n cartDelete: function cartDelete(state, payload) {\n var ids = payload.cart_id.split(\",\");\n\n if (payload.types == 1) {\n //联营\n if (payload.act == 'normal') {\n //删除操作\n var datalistp = payload.delivery == 1 ? state.ly1Data : state.ly2Data;\n\n for (var i = 0; i < datalistp.length; i++) {\n for (var j = 0; j < ids.length; j++) {\n if (datalistp[i].cart_id == ids[j]) {\n datalistp.splice(i, 1);\n }\n }\n }\n\n if (payload.delivery == 1) {\n state.ly1Data = datalistp;\n state.ly1Length = Number(state.ly1Length) - ids.length;\n } else {\n state.ly2Data = datalistp;\n state.ly2Length = Number(state.ly2Length) - ids.length;\n }\n } else {\n //清除过期数据\n if (payload.delivery == 1) {\n state.ly1LoseData = [];\n } else {\n state.ly2LoseData = [];\n }\n }\n } else {\n //自营\n if (payload.act == 'normal') {\n //删除\n for (var i = 0; i < state.zy1Data.length; i++) {\n for (var j = 0; j < ids.length; j++) {\n if (state.zy1Data[i].cart_id == ids[j]) {\n state.zy1Data.splice(i, 1);\n }\n }\n }\n\n for (var ii = 0; ii < state.zy2Data.length; i++) {\n for (var jj = 0; jj < ids.length; jj++) {\n if (state.zy2Data[ii].cart_id == ids[jj]) {\n state.zy2Data.splice(ii, 1);\n }\n }\n }\n\n state.zy1Length = Number(state.zy1Length) - ids.length;\n } else {\n //清除过期数据\n state.zy1LoseData = [];\n }\n }\n },\n changenum: function changenum(state, payload) {\n if (payload.delivery_place == 1 || payload.delivery_place == 2) {\n //大陆//香港\n var list_ = payload.delivery_place == 1 ? state.ly1Data : state.ly2Data;\n\n for (var i = 0; i < list_.length; i++) {\n if (list_[i].cart_id == payload.cart_id) {\n list_[i].goods_number = payload.data.num;\n list_[i].goods_amount = payload.data.goods_amount;\n list_[i].goods_amount_format = payload.data.goods_amount_format;\n list_[i].goods_price = payload.data.goods_price;\n list_[i].goods_price_format = payload.data.goods_price_format;\n }\n }\n } else {\n //自营\n var list_1 = state.zy1Data,\n list_2 = state.zy2Data;\n\n for (var i = 0; i < list_1.length; i++) {\n if (list_1[i].cart_id == payload.cart_id) {\n list_1[i].goods_number = payload.data.num;\n list_1[i].goods_amount = payload.data.goods_amount;\n list_1[i].goods_amount_format = payload.data.goods_amount_format;\n list_1[i].goods_price = payload.data.goods_price;\n list_1[i].goods_price_format = payload.data.goods_price_format;\n\n if (payload.data.sale_type == 2) {\n var arrj = list_1[i];\n list_1.splice(i, 1);\n state.zy2Data.push(arrj);\n }\n }\n }\n\n for (var j = 0; j < list_2.length; j++) {\n if (list_2[j].cart_id == payload.cart_id) {\n list_2[j].goods_number = payload.data.num;\n list_2[j].goods_amount = payload.data.goods_amount;\n list_2[j].goods_amount_format = payload.data.goods_amount_format;\n list_2[j].goods_price = payload.data.goods_price;\n\n if (payload.data.sale_type == 1) {\n var arrj = list_2[j];\n list_2.splice(j, 1);\n state.zy1Data.push(arrj);\n }\n }\n }\n }\n\n state.totlaMState = true;\n }\n};\nvar actions = {\n cartList: function cartList(_ref, payload) {\n var commit = _ref.commit;\n state.loading = true;\n state.loading1 = true;\n var params = {\n delivery_place: payload.delivery_place,\n order_goods_type: payload.order_goods_type\n };\n var types_;\n\n if (payload.order_goods_type == 2) {\n types_ = 3;\n } else {\n types_ = payload.delivery_place;\n }\n\n _api_index__WEBPACK_IMPORTED_MODULE_4__[\"services\"].cartList(qs.stringify(params)).then(function (res) {\n state.loading = false;\n state.loading1 = false;\n var data = res.data;\n\n if (types_ == 1) {\n //大陆\n state.ly1 = true;\n } else if (types_ == 2) {\n //香港\n state.ly2 = true;\n } else {\n //自营\n state.zy1 = true;\n }\n\n if (data.err_code == 0) {\n commit({\n type: 'cartList',\n data: data.data,\n types_: types_\n });\n } else {// Toast({\n // message: data.err_msg,\n // duration: 3000\n // });\n }\n }).catch(function (err) {\n state.loading = false;\n state.loading1 = false;\n });\n },\n allcount: function allcount(_ref2, payload) {\n var commit = _ref2.commit;\n _api_index__WEBPACK_IMPORTED_MODULE_4__[\"services\"].allcount().then(function (res) {\n var data = res.data;\n\n if (data.err_code == 0) {\n state.ly1Length = Number(data.data['1']['1'] || 0);\n state.ly2Length = Number(data.data['1']['2'] || 0);\n state.zy1Length = Number(data.data['2']['1'] || 0);\n }\n });\n },\n cartDelete: function cartDelete(_ref3, payload) {\n var commit = _ref3.commit;\n state.loading = true;\n var params = {\n cart_id: payload.cart_id,\n act: payload.act\n };\n _api_index__WEBPACK_IMPORTED_MODULE_4__[\"services\"].cartDelete(qs.stringify(params)).then(function (res) {\n state.loading = false;\n var data = res.data;\n\n if (data.err_code == 0) {\n commit({\n type: 'cartDelete',\n data: data.data,\n act: payload.act,\n cart_id: payload.cart_id,\n types: payload.types,\n delivery: payload.delivery\n });\n } else {\n Object(vant__WEBPACK_IMPORTED_MODULE_3__[\"Toast\"])({\n message: data.err_msg,\n duration: 3000\n });\n }\n }).catch(function (err) {\n state.loading = false;\n });\n },\n confirmBehavior: function confirmBehavior(_ref4, payload) {\n var commit = _ref4.commit;\n state.loading = true;\n _api_index__WEBPACK_IMPORTED_MODULE_4__[\"services\"].confirmBehavior().then(function (res) {\n state.loading = false;\n window.location.href = payload.url_;\n }).catch(function (err) {\n state.loading = false;\n });\n },\n changenum: function changenum(_ref5, payload) {\n var commit = _ref5.commit;\n\n if (payload.types == 1 || payload.types == 2) {\n state.loading = true;\n }\n\n var params = {\n cart_id: payload.cart_id,\n num: payload.num,\n delivery_place: payload.delivery_place\n };\n state.totlaMState = false;\n _api_index__WEBPACK_IMPORTED_MODULE_4__[\"services\"].changenum(qs.stringify(params)).then(function (res) {\n state.loading = false;\n var data = res.data;\n\n if (data.err_code == 0) {\n commit({\n type: 'changenum',\n data: data.data,\n cart_id: payload.cart_id,\n delivery_place: payload.delivery_place\n });\n } else {\n Object(vant__WEBPACK_IMPORTED_MODULE_3__[\"Toast\"])({\n message: data.err_msg,\n duration: 3000\n });\n }\n }).catch(function (err) {\n state.loading = false;\n });\n }\n};\nvar getters = {};\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n state: state,\n mutations: mutations,\n actions: actions,\n getters: getters\n});\n\n//# sourceURL=webpack:///./src/store/modules/car/index.js?");
/***/ }),
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