Commit 0f76a221 authored by zhengke's avatar zhengke

修改

parent d77ac75e
<template> <template>
<view <view class="actionsheet" :style="{ 'padding-bottom': bian ? '28px' : '0px' }">
class="actionsheet" <view class="item" style="width:36px;" @click="goCart">
:style="{ 'padding-bottom': bian ? '28px' : '0px' }" <view style="width: 22px; margin: auto;"><u-icon name="cart-o" size="44" :color="mc"></u-icon></view>
> <text class="text" :style="{ color: mc }">购物车</text>
<view class="item" style="width:36px;" @click="goCart"> </view>
<view style="width: 22px; margin: auto;"> <view class="item">
<u-icon name="cart-o" size="44" :color="mc"></u-icon> <view style="width: 22px; margin: auto;"><u-icon name="chat-o" size="44" color="#333"></u-icon></view>
</view> <text class="text">客服</text>
<text class="text" :style="{'color':mc}">购物车</text> <button open-type="contact" :send-message-title="goodName" :send-message-path="path" :send-message-img="g.coverPic" :show-message-card="true">0</button>
</view> </view>
<view class="item"> <view class="item" @click="setFavorite">
<view style="width: 22px; margin: auto;"> <view style="width: 22px; margin: auto;"><u-icon :name="favorStatus ? 'like' : 'like-o'" size="44" :color="favorStatus ? mc : '#333'"></u-icon></view>
<u-icon name="chat-o" size="44" color="#333"></u-icon> <text class="text">收藏</text>
</view> </view>
<text class="text">客服</text> <view class="item2">
<button <view style="flex: 1;"><u-button @click="joinCar" :ripple="true" :hair-line="false" :custom-style="btn1">加入购物车</u-button></view>
open-type="contact" <view style="flex: 1;"><u-button @click="buy" :ripple="true" :hair-line="false" :custom-style="btn2">立即购买</u-button></view>
:send-message-title="goodName" </view>
:send-message-path="path" <auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="goback"></auth>
:send-message-img="g.coverPic" </view>
:show-message-card="true"
>
0
</button>
</view>
<view class="item" @click="setFavorite">
<view style="width: 22px; margin: auto;">
<u-icon
:name="favorStatus ? 'like' : 'like-o'"
size="44"
:color="favorStatus ? mc : '#333'"
></u-icon>
</view>
<text class="text">收藏</text>
</view>
<view class="item2">
<view style="flex: 1;">
<u-button
@click="joinCar"
:ripple="true"
:hair-line="false"
:custom-style="btn1"
>加入购物车</u-button
>
</view>
<view style="flex: 1;">
<u-button
@click="buy"
:ripple="true"
:hair-line="false"
:custom-style="btn2"
>立即购买</u-button
>
</view>
</view>
</view>
</template> </template>
<script> <script>
import auth from "../../components/auth/index.vue";
export default { export default {
props: ["coverPic", "goodName", "favorite", "goodId"], props: ['coverPic', 'goodName', 'favorite', 'goodId'],
data() { data() {
return { return {
mc: "", mc: '',
fu: "", fu: '',
bian: false, bian: false,
btn1: { btn1: {
flex: 1, flex: 1,
height: "100%", height: '100%',
borderRadius: "40px 0 0 40px", borderRadius: '40px 0 0 40px',
border: "none", border: 'none',
color: "#FFF", color: '#FFF',
fontSize: "13px", fontSize: '13px',
width: "100%", width: '100%'
}, },
btn2: { btn2: {
flex: 1, flex: 1,
height: "100%", height: '100%',
borderRadius: "0 40px 40px 0", borderRadius: '0 40px 40px 0',
border: "none", border: 'none',
color: "#FFF", color: '#FFF',
fontSize: "13px", fontSize: '13px',
width: "100%", width: '100%'
}, },
path: "", path: '',
favorStatus: false, favorStatus: false,
}; //是否显示登陆
}, showAuth: false,
mounted() { u: {}
this.mc = this.$uiConfig.mainColor; };
this.fu = this.$uiConfig.secondary; },
this.bian = this.$utils.is_biang; components: {
this.btn1.background = this.fu; auth
this.btn2.background = this.mc; },
let t = getCurrentPages(); mounted() {
this.path = "/" + t[t.length - 1].route; this.mc = this.$uiConfig.mainColor;
//console.log(t[t.length - 1]); this.fu = this.$uiConfig.secondary;
this.favorStatus = this.favorite; this.bian = this.$utils.is_biang;
}, this.btn1.background = this.fu;
methods: { this.btn2.background = this.mc;
goCart(){ let t = getCurrentPages();
uni.redirectTo({ this.path = '/' + t[t.length - 1].route;
url: '/pages/cart/cart' //console.log(t[t.length - 1]);
}); this.favorStatus = this.favorite;
}, },
setFavorite() { methods: {
let h=this.apiheader() goCart() {
this.request2( uni.redirectTo({
url: '/pages/cart/cart'
{ });
url: '/api/AppletUser/SetUserCollectionInfo', },
data: { setFavorite() {
GoodsId:this.goodId this.u = uni.getStorageSync('mall_UserInfo');
if (!this.u) {
this.u = {
nickName: '未登录',
avatarUrl: ''
};
this.showAuth = true;
} else {
this.request2(
{
url: '/api/AppletUser/SetUserCollectionInfo',
data: {
GoodsId: this.goodId
}
},
res => {
this.favorStatus = !this.favorStatus;
}
);
}
},
joinCar() {
this.u = uni.getStorageSync('mall_UserInfo');
if (!this.u) {
this.u = {
nickName: '未登录',
avatarUrl: ''
};
this.showAuth = true;
} else {
this.$emit('join-car');
} }
}, },
(res) => { buy() {
this.favorStatus = !this.favorStatus; this.$emit('buy');
} },
);
}, reloadUserinfo() {
joinCar() { this.u = uni.getStorageSync('mall_UserInfo');
this.$emit("join-car"); this.showAuth = false;
}, },
buy() { goback() {
this.$emit("buy"); uni.navigateBack();
}, }
}, }
}; };
</script> </script>
<style> <style>
.actionsheet { .actionsheet {
display: flex; display: flex;
background: #fff; background: #fff;
position: fixed; position: fixed;
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
z-index: 3; z-index: 3;
height: 50px; height: 50px;
align-items: center; align-items: center;
} }
.actionsheet .item { .actionsheet .item {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
margin: 0 10px; margin: 0 10px;
color: #333; color: #333;
font-size: 12px; font-size: 12px;
padding: 3px 0; padding: 3px 0;
width: 30px; width: 30px;
position: relative; position: relative;
} }
.actionsheet .item .text { .actionsheet .item .text {
margin-top: 2px; margin-top: 2px;
text-align: center; text-align: center;
} }
.actionsheet .item2 { .actionsheet .item2 {
flex: 1; flex: 1;
width: 1px; width: 1px;
padding: 5px; padding: 5px;
box-sizing: border-box; box-sizing: border-box;
margin-left: 10px; margin-left: 10px;
height: 100%; height: 100%;
display: flex; display: flex;
} }
.actionsheet .item button { .actionsheet .item button {
width: 100%; width: 100%;
height: 100%; height: 100%;
opacity: 0; opacity: 0;
left: 0; left: 0;
top: 0; top: 0;
position: absolute; position: absolute;
} }
</style> </style>
...@@ -138,7 +138,6 @@ export default { ...@@ -138,7 +138,6 @@ export default {
}; };
}, },
mounted() { mounted() {
console.log("good",this.good)
this.request2( this.request2(
{ {
url: '/api/AppletGoods/GetAppletGoodsInfo', url: '/api/AppletGoods/GetAppletGoodsInfo',
...@@ -147,7 +146,6 @@ export default { ...@@ -147,7 +146,6 @@ export default {
} }
}, },
res => { res => {
console.log(res, 'resssssss');
this.g = res.data.goods; this.g = res.data.goods;
this.goodimage = this.g.cover_pic; this.goodimage = this.g.cover_pic;
...@@ -195,7 +193,6 @@ export default { ...@@ -195,7 +193,6 @@ export default {
}, },
methods: { methods: {
joinCar() { joinCar() {
console.log(this.skuObj,'skuObjj');
if (this.skuObj && this.skuObj.id) { if (this.skuObj && this.skuObj.id) {
this.request2( this.request2(
{ {
...@@ -225,24 +222,38 @@ export default { ...@@ -225,24 +222,38 @@ export default {
} }
}, },
buy() { buy() {
let ShoppingCartIdList=[];
if (this.skuObj && this.skuObj.id) { if (this.skuObj && this.skuObj.id) {
let good = {
DetailList: [],
Use_Integral: 0,
User_Coupon_Id: 0,
DeliveryMethod:0,
AddressId:0,
};
let g = { let g = {
id: this.skuObj.goods_id, GoodsId: this.skuObj.goods_id,
num: this.gc, Number: this.gc,
cart_id: 0, SpecificationSort: this.skuObj.sign_id,
goods_attr_id: this.skuObj.id,
attr: []
}; };
this.skuObj.attr_list.forEach(x => { good.DetailList.push(g);
g.attr.push({ // let g = {
attr_id: x.attr_id, // id: this.skuObj.goods_id,
attr_group_id: x.attr_group_id // num: this.gc,
}); // cart_id: 0,
}); // goods_attr_id: this.skuObj.id,
this.forms.list[0].goods_list.push(g); // attr: []
this.forms.list[0].mch_id = this.g.mch_id; // };
// this.skuObj.attr_list.forEach(x => {
// g.attr.push({
// attr_id: x.attr_id,
// attr_group_id: x.attr_group_id
// });
// });
// this.forms.list[0].goods_list.push(g);
// this.forms.list[0].mch_id = this.g.mch_id;
uni.navigateTo({ uni.navigateTo({
url: '/pages/order-submit/order-submit?formData=' + encodeURIComponent(JSON.stringify(this.forms)), url: '/pages/order-submit/order-submit?formData=' + encodeURIComponent(JSON.stringify(good))+'&IsFormShoppingCart=2&ShoppingCartIdList='+JSON.stringify(ShoppingCartIdList),
complete(res) { complete(res) {
console.log(res); console.log(res);
} }
......
...@@ -221,7 +221,7 @@ export default { ...@@ -221,7 +221,7 @@ export default {
goodData: [], goodData: [],
showGoodList: false, showGoodList: false,
DetailList: [], DetailList: [],
IsFormShoppingCart: 1, IsFormShoppingCart: 2,
adressInfo: {}, adressInfo: {},
payInfo: { payInfo: {
OpenId: 'ow_7I5XC1-RGwwk8QANBmWKYKmOc', OpenId: 'ow_7I5XC1-RGwwk8QANBmWKYKmOc',
...@@ -229,7 +229,7 @@ export default { ...@@ -229,7 +229,7 @@ export default {
OrderPayType: 1, OrderPayType: 1,
GoodsName: '' GoodsName: ''
}, },
ShoppingCartIdList: [6, 5] ShoppingCartIdList: []
}; };
}, },
onLoad(option) { onLoad(option) {
......
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 to comment