Commit 0bb369e7 by 肖康

x

parent 1ab55f47
...@@ -68,6 +68,11 @@ export const apis = { ...@@ -68,6 +68,11 @@ export const apis = {
* 获取购物车列表 * 获取购物车列表
*/ */
cartList: productionUrlApi + 'cart/lists', cartList: productionUrlApi + 'cart/lists',
/**
* 获取购物各种类型数量
*/
allcount: productionUrlApi + 'cart/allcount',
/** /**
* 客服统计处理 * 客服统计处理
*/ */
...@@ -470,4 +475,9 @@ export const services = { ...@@ -470,4 +475,9 @@ export const services = {
cartList(params){ cartList(params){
return axios.post(apis.cartList,params) return axios.post(apis.cartList,params)
}, },
allcount(params){
return axios.post(apis.allcount,params)
},
}; };
\ No newline at end of file
...@@ -12,20 +12,58 @@ const state = { ...@@ -12,20 +12,58 @@ const state = {
ly1Data:[],//大陆数据 ly1Data:[],//大陆数据
ly2Data:[],//香港数据 ly2Data:[],//香港数据
zy1Data:[],//自营数据 zy1Data:[],//自营数据
ly1Length:0,
ly2Length:0,
zy1Length:0,
ly1LoseData:[],
ly2LoseData:[],
zy1LoseData:[],
} }
const mutations = { const mutations = {
cartList(state, payload) { cartList(state, payload) {
if(payload.types_==1){ if(payload.types_==1){
state.ly1=true;
//大陆 //大陆
var arr_=payload.data.list;
for(var i=0;i<arr_.length;i++){
arr_[i].check=true;
if(arr_[i].status==-1){
state.ly1LoseData.push(arr_[i]);
}else{
state.ly1Data.push(arr_[i])
}
}
}else if(payload.types_==2){ }else if(payload.types_==2){
state.ly2=true;
//香港 //香港
var arr_=payload.data.list;
for(var i=0;i<arr_.length;i++){
arr_[i].check=true;
if(arr_[i].status==-1){
state.ly2LoseData.push(arr_[i]);
}else{
state.ly2Data.push(arr_[i])
}
}
}else{ }else{
//自营 //自营
state.zy1=true; var arr_=payload.data.list;
for(var i=0;i<arr_.length;i++){
if(arr_[i].sale_type==2){
//期货 //默认不勾选
arr_[i].check=false;
}else{
//现货默认勾选
arr_[i].check=true;
} }
if(arr_[i].status==-1){
state.zy1LoseData.push(arr_[i]);
}else{
state.zy1Data.push(arr_[i])
}
}
}
} }
} }
...@@ -36,17 +74,26 @@ const actions = { ...@@ -36,17 +74,26 @@ const actions = {
delivery_place: payload.delivery_place, delivery_place: payload.delivery_place,
order_goods_type: payload.order_goods_type order_goods_type: payload.order_goods_type
} }
var types_=1; var types_;
if(payload.order_goods_type==1){ if(payload.order_goods_type==2){
types_=3; types_=3;
}else{ }else{
if(payload.delivery_place==2){ types_=payload.delivery_place;
types_=2
}
} }
Services.cartList(qs.stringify(params)).then((res) => { Services.cartList(qs.stringify(params)).then((res) => {
console.log(types_)
state.loading=false; state.loading=false;
let data = res.data; let data = res.data;
if(types_==1){
//大陆
state.ly1=true;
}else if(types_==2){
//香港
state.ly2=true;
}else{
//自营
state.zy1=true;
}
if (data.err_code == 0) { if (data.err_code == 0) {
commit({ commit({
type: 'cartList', type: 'cartList',
...@@ -62,7 +109,18 @@ const actions = { ...@@ -62,7 +109,18 @@ const actions = {
}).catch(function (err) { }).catch(function (err) {
state.loading = false; state.loading = 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);
}
})
} }
} }
const getters = {} const getters = {}
......
import Vue from 'vue'
export default new Vue
\ No newline at end of file
<template> <template>
<div class="car-page"> <div class="car-page">
<Header :isCar="isCar" :meaushow="meaushow" :bgcolor="bgcolor" @listTab="listTab"></Header> <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>
<div class="lxBox" v-show="type==1" :style="{'paddingTop':paddingTop+'px'}"> <span class="fl" :class="{'act':(delivery==2)}" @click="deliveryTab(2)" v-back-top-window>香港交货({{ly2Length}})</span>
<div class="lyNav clr">
<span class="fl" :class="{'act':(delivery==1)}" @click="deliveryTab(1)" v-back-top-window>大陆交货(0)<font class="fr">|</font></span>
<span class="fl" :class="{'act':(delivery==2)}" @click="deliveryTab(2)" v-back-top-window>香港交货(0)</span>
</div> </div>
<!--登录提示框--> <!--登录提示框-->
<div class="logintip" v-if="!isLogingo"> <div class="logintip lyfixed" v-if="!isLogingo">
<span>登录后商品会同步到您账户中</span> <span>登录后商品会同步到您账户中</span>
<a :href="loginUrl">登录</a> <a :href="loginUrl">登录</a>
</div> </div>
<div class="dataBox">
<!--编辑--> <!--编辑-->
<div class="editBox clr" :style="{'top':(paddingTop+44)+'px'}"> <div class="editBox clr lyfixed" :style="{'top':(paddingTop+44)+'px'}">
<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="isEdit=!isEdit" v-if="isEdit">完成</a> <a href="javascript:void(0)" class="edit-btn fr" @click="isEdit=!isEdit" v-if="isEdit">完成</a>
<a href="javascript:void(0)" class="edit-btn fr" @click="isEdit=!isEdit" v-if="!isEdit">编辑</a> <a href="javascript:void(0)" class="edit-btn fr" @click="isEdit=!isEdit" v-if="!isEdit">编辑</a>
</div> </div>
<!--登录提示框-->
<div class="logintip zyfixed" v-if="!isLogingo">
<span>登录后商品会同步到您账户中</span>
<a :href="loginUrl">登录</a>
</div>
<!--编辑-->
<div class="editBox clr zyfixed" :style="{'top':paddingTop+'px'}">
<a href="javascript:void(0)" class="edit-btn fr" @click="isEdit=!isEdit" v-if="isEdit">完成</a>
<a href="javascript:void(0)" class="edit-btn fr" @click="isEdit=!isEdit" v-if="!isEdit">编辑</a>
</div>
<Header :isCar="isCar" :ly1Length="ly1Length" :ly2Length="ly2Length" :zy1Length="zy1Length" :meaushow="meaushow" :bgcolor="bgcolor" @listTab="listTab"></Header>
<!--联营盒子-->
<div class="lxBox" v-show="type==1" :style="{'paddingTop':paddingTop+'px'}">
<div class="dataBox">
<div class="dlBox" v-show="delivery==1"> <div class="dlBox" v-show="delivery==1">
<div class="mui-row shop-block sale_type_data" > <div class="mui-row shop-block sale_type_data" >
<div class="mui-col-sm-1 mui-col-xs-1 ta-c mt-10"> <div class="mui-col-sm-1 mui-col-xs-1 ta-c mt-10">
...@@ -250,17 +261,9 @@ ...@@ -250,17 +261,9 @@
</div> </div>
<!--自营盒子--> <!--自营盒子-->
<div class="zyBox" v-show="type==2" :style="{'paddingTop':(paddingTop-44)+'px'}"> <div class="zyBox" v-show="type==2" :style="{'paddingTop':(paddingTop-44)+'px'}">
<!--登录提示框-->
<div class="logintip" v-if="!isLogingo">
<span>登录后商品会同步到您账户中</span>
<a :href="loginUrl">登录</a>
</div>
<div class="dataBox"> <div class="dataBox">
<!--编辑-->
<div class="editBox clr" :style="{'top':paddingTop+'px'}">
<a href="javascript:void(0)" class="edit-btn fr" @click="isEdit=!isEdit" v-if="isEdit">完成</a>
<a href="javascript:void(0)" class="edit-btn fr" @click="isEdit=!isEdit" v-if="!isEdit">编辑</a>
</div>
<div class="zyDataGp"> <div class="zyDataGp">
<div class="xianhuoData"> <div class="xianhuoData">
<div class="mui-row headxianhuoqihuo" > <div class="mui-row headxianhuoqihuo" >
...@@ -559,11 +562,18 @@ ...@@ -559,11 +562,18 @@
ly1Data: state => state.car.ly1Data, ly1Data: state => state.car.ly1Data,
ly2Data: state => state.car.ly2Data, ly2Data: state => state.car.ly2Data,
zy1Data: state => state.car.zy1Data, zy1Data: state => state.car.zy1Data,
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,
}) })
}, },
created(){ created(){
this.loginTip(); this.loginTip();
this.getCarCount();
this.getData(); this.getData();
}, },
watch:{ watch:{
...@@ -606,12 +616,18 @@ ...@@ -606,12 +616,18 @@
}, },
listTab:function(type){ listTab:function(type){
this.type=type; this.type=type;
// if(type==1){ if(type==2&&this.zy1){
// return
// }else{ }
// if(type==1){
// } if(this.delivery==1&&this.ly1){
console.log(type) return
}
if(this.delivery==2&&this.ly2){
return
}
}
this.getData();
}, },
getData:function(){ getData:function(){
this.$store.dispatch({ this.$store.dispatch({
...@@ -620,8 +636,20 @@ ...@@ -620,8 +636,20 @@
order_goods_type: this.type order_goods_type: this.type
}) })
}, },
getCarCount:function(){
this.$store.dispatch({
type: 'allcount'
})
},
deliveryTab:function(delivery){ deliveryTab:function(delivery){
this.delivery=delivery; this.delivery=delivery;
if(this.delivery==1&&this.ly1){
return
}
if(this.delivery==2&&this.ly2){
return
}
this.getData();
} }
}, },
components:{ components:{
......
...@@ -88,7 +88,17 @@ ...@@ -88,7 +88,17 @@
</div> </div>
</div> </div>
<div class="but-shop"> <div class="but-shop">
<a class="but" @click="placeOrder(itemchild.goods_id)">我要下单</a> <template v-if="isZy">
<a class="but" v-if="itemchild.is_buy==1" @click="placeOrder(itemchild.goods_id)">我要下单</a>
<a class="but but-orange" v-else @click="xunjia">立即询价</a>
</template>
<template v-else="isZy">
<a class="but" v-if="itemchild.is_buy==1" @click="placeOrder(itemchild.goods_id)">我要下单</a>
<a class="but but-orange" v-else-if="itemchild.is_buy==0" @click="xunjia">立即询价</a>
<a class="but but-orange" v-else-if="itemchild.is_buy==3" @click="xunjia">确认库存信息</a>
</template>
</div> </div>
</div> </div>
</div> </div>
...@@ -97,6 +107,7 @@ ...@@ -97,6 +107,7 @@
<script> <script>
import Vue from "vue"; import Vue from "vue";
import { Lazyload } from "vant"; import { Lazyload } from "vant";
import bus from '../../util/bus.js'
Vue.use(Lazyload); Vue.use(Lazyload);
export default { export default {
name: "GoodsOne", name: "GoodsOne",
...@@ -140,6 +151,9 @@ export default { ...@@ -140,6 +151,9 @@ export default {
}, },
placeOrder(id) { placeOrder(id) {
this.$emit("placeOrder", id); this.$emit("placeOrder", id);
},
xunjia(){
bus.$emit('xunjia')
} }
}, },
components: {} components: {}
...@@ -274,7 +288,6 @@ export default { ...@@ -274,7 +288,6 @@ export default {
height: 30px; height: 30px;
float: right; float: right;
line-height: 30px; line-height: 30px;
padding: 0 20px;
width: 100px; width: 100px;
font-size: 14px; font-size: 14px;
display: block; display: block;
...@@ -284,6 +297,9 @@ export default { ...@@ -284,6 +297,9 @@ export default {
cursor: pointer; cursor: pointer;
box-sizing: border-box; box-sizing: border-box;
border-radius: 4px; border-radius: 4px;
&.but-orange{
background: #ffa200;
}
} }
} }
.more-height, .more-height,
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
<i class="icon iconfont icon-xiangzuo fl" @click="historyback"></i> <i class="icon iconfont icon-xiangzuo fl" @click="historyback"></i>
<div v-if="isCar"> <div v-if="isCar">
<div class="car-title clr"> <div class="car-title clr">
<span class="fl" :class="{'act':(type==1)}" @click="listTab(1)" v-back-top-window>联营(<font>0</font>)</span> <span class="fl" :class="{'act':(type==1)}" @click="listTab(1)" v-back-top-window>联营(<font>{{ly1Length+ly2Length}}</font>)</span>
<span class="fl" :class="{'act':(type==2)}" @click="listTab(2)" v-back-top-window>自营(<font>0</font>)</span> <span class="fl" :class="{'act':(type==2)}" @click="listTab(2)" v-back-top-window>自营(<font>{{zy1Length}}</font>)</span>
</div> </div>
</div> </div>
<div class="search" v-else-if="inputShow"> <div class="search" v-else-if="inputShow">
...@@ -27,6 +27,18 @@ export default { ...@@ -27,6 +27,18 @@ export default {
type: String, type: String,
default: "" default: ""
}, },
zy1Length: {
type: Number,
default:0
},
ly1Length: {
type: Number,
default: 0
},
ly2Length: {
type: Number,
default:0
},
bgcolor:{ bgcolor:{
type: String, type: String,
default: "#f3f3f3" default: "#f3f3f3"
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
import { mapState } from "vuex"; import { mapState } from "vuex";
import Vue from "vue"; import Vue from "vue";
import { Dialog } from "vant"; import { Dialog } from "vant";
import bus from '../../util/bus.js'
Vue.use(Dialog); Vue.use(Dialog);
...@@ -76,6 +77,13 @@ export default { ...@@ -76,6 +77,13 @@ export default {
default: false default: false
} }
}, },
created(){
var self=this;
bus.$on('xunjia',function(){
self.recordFn()
})
},
data() { data() {
return { return {
flag: false, flag: false,
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
</div> </div>
</div> </div>
<van-loading type="spinner" color="#000" class="loading-background" v-if="loading"/> <van-loading type="spinner" color="#000" class="loading-background" v-if="loading"/>
<SideBar :isWindow="isWindow" :carshow="carshow"></SideBar> <SideBar :isWindow="isWindow" :carshow="carshow" ></SideBar>
<goodsDetail :detailsData="detailsData"></goodsDetail> <goodsDetail :detailsData="detailsData"></goodsDetail>
</section> </section>
</template> </template>
...@@ -213,6 +213,7 @@ ...@@ -213,6 +213,7 @@
} }
} }
} }
}, },
components: { components: {
Header, Header,
......
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