Commit 0bb369e7 by 肖康

x

parent 1ab55f47
......@@ -68,6 +68,11 @@ export const apis = {
* 获取购物车列表
*/
cartList: productionUrlApi + 'cart/lists',
/**
* 获取购物各种类型数量
*/
allcount: productionUrlApi + 'cart/allcount',
/**
* 客服统计处理
*/
......@@ -470,4 +475,9 @@ export const services = {
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 = {
ly1Data:[],//大陆数据
ly2Data:[],//香港数据
zy1Data:[],//自营数据
ly1Length:0,
ly2Length:0,
zy1Length:0,
ly1LoseData:[],
ly2LoseData:[],
zy1LoseData:[],
}
const mutations = {
cartList(state, payload) {
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){
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{
//自营
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 = {
delivery_place: payload.delivery_place,
order_goods_type: payload.order_goods_type
}
var types_=1;
if(payload.order_goods_type==1){
var types_;
if(payload.order_goods_type==2){
types_=3;
}else{
if(payload.delivery_place==2){
types_=2
}
types_=payload.delivery_place;
}
Services.cartList(qs.stringify(params)).then((res) => {
console.log(types_)
state.loading=false;
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) {
commit({
type: 'cartList',
......@@ -62,7 +109,18 @@ const actions = {
}).catch(function (err) {
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 = {}
......
import Vue from 'vue'
export default new Vue
\ No newline at end of file
<template>
<div class="car-page">
<Header :isCar="isCar" :meaushow="meaushow" :bgcolor="bgcolor" @listTab="listTab"></Header>
<!--联营盒子-->
<div class="lxBox" v-show="type==1" :style="{'paddingTop':paddingTop+'px'}">
<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 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>
</div>
<!--登录提示框-->
<div class="logintip" v-if="!isLogingo">
<div class="logintip lyfixed" v-if="!isLogingo">
<span>登录后商品会同步到您账户中</span>
<a :href="loginUrl">登录</a>
</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>
<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="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="mui-row shop-block sale_type_data" >
<div class="mui-col-sm-1 mui-col-xs-1 ta-c mt-10">
......@@ -250,17 +261,9 @@
</div>
<!--自营盒子-->
<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="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="xianhuoData">
<div class="mui-row headxianhuoqihuo" >
......@@ -559,11 +562,18 @@
ly1Data: state => state.car.ly1Data,
ly2Data: state => state.car.ly2Data,
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(){
this.loginTip();
this.getCarCount();
this.getData();
},
watch:{
......@@ -606,12 +616,18 @@
},
listTab:function(type){
this.type=type;
// if(type==1){
//
// }else{
//
// }
console.log(type)
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(){
this.$store.dispatch({
......@@ -620,8 +636,20 @@
order_goods_type: this.type
})
},
getCarCount:function(){
this.$store.dispatch({
type: 'allcount'
})
},
deliveryTab:function(delivery){
this.delivery=delivery;
if(this.delivery==1&&this.ly1){
return
}
if(this.delivery==2&&this.ly2){
return
}
this.getData();
}
},
components:{
......
......@@ -88,7 +88,17 @@
</div>
</div>
<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>
......@@ -97,6 +107,7 @@
<script>
import Vue from "vue";
import { Lazyload } from "vant";
import bus from '../../util/bus.js'
Vue.use(Lazyload);
export default {
name: "GoodsOne",
......@@ -140,6 +151,9 @@ export default {
},
placeOrder(id) {
this.$emit("placeOrder", id);
},
xunjia(){
bus.$emit('xunjia')
}
},
components: {}
......@@ -274,7 +288,6 @@ export default {
height: 30px;
float: right;
line-height: 30px;
padding: 0 20px;
width: 100px;
font-size: 14px;
display: block;
......@@ -284,6 +297,9 @@ export default {
cursor: pointer;
box-sizing: border-box;
border-radius: 4px;
&.but-orange{
background: #ffa200;
}
}
}
.more-height,
......
......@@ -4,8 +4,8 @@
<i class="icon iconfont icon-xiangzuo fl" @click="historyback"></i>
<div v-if="isCar">
<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==2)}" @click="listTab(2)" 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>{{zy1Length}}</font>)</span>
</div>
</div>
<div class="search" v-else-if="inputShow">
......@@ -27,6 +27,18 @@ export default {
type: String,
default: ""
},
zy1Length: {
type: Number,
default:0
},
ly1Length: {
type: Number,
default: 0
},
ly2Length: {
type: Number,
default:0
},
bgcolor:{
type: String,
default: "#f3f3f3"
......
......@@ -57,6 +57,7 @@
import { mapState } from "vuex";
import Vue from "vue";
import { Dialog } from "vant";
import bus from '../../util/bus.js'
Vue.use(Dialog);
......@@ -76,6 +77,13 @@ export default {
default: false
}
},
created(){
var self=this;
bus.$on('xunjia',function(){
self.recordFn()
})
},
data() {
return {
flag: false,
......
......@@ -52,7 +52,7 @@
</div>
</div>
<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>
</section>
</template>
......@@ -213,6 +213,7 @@
}
}
}
},
components: {
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