Commit 174d9601 by 程智春

Merge branch 'nativehome_tst' of http://code.mayi888.com/chengmo/mayi-mp-shop into nativehome_tst

parents 6e5a02e3 49d9c61b
...@@ -69,7 +69,8 @@ Component({ ...@@ -69,7 +69,8 @@ Component({
show: true, show: true,
mmm: false, mmm: false,
mainColor: "", mainColor: "",
showFlag: "up" showFlag: "up",
cartNum: 0
}, },
ready() { ready() {
if (app.themeColor["--main-color"] != "#ffffff") { if (app.themeColor["--main-color"] != "#ffffff") {
...@@ -92,35 +93,49 @@ Component({ ...@@ -92,35 +93,49 @@ Component({
} }
this.setData({ this.setData({
mmm: Math.ceil(app.globalData.footerVal.componentData.list.length / 2 - 1) mmm: Math.ceil(app.globalData.footerVal.componentData.list.length / 2 - 1)
}) });
console.log(Math.ceil(app.globalData.footerVal.componentData.list.length / 2 - 1), this.data.selected) console.log(
console.log(this.data.mmm,'ready') Math.ceil(app.globalData.footerVal.componentData.list.length / 2 - 1),
this.data.selected
);
console.log(this.data.mmm, "ready");
}, },
attached() { attached() {
let that = this; let that = this;
if (app.globalData.footerVal) { if (app.globalData.footerVal) {
let mm=(Math.ceil(app.globalData.footerVal.componentData.list.length/2-1)==that.data.selected&&app.globalData.footerVal.componentData['styleSelectionNum']==1) let mm =
Math.ceil(app.globalData.footerVal.componentData.list.length / 2 - 1) ==
that.data.selected &&
app.globalData.footerVal.componentData["styleSelectionNum"] == 1;
console.log(733333,mm) console.log(733333, mm);
that.setData({ that.setData({
componentData: app.globalData.footerVal.componentData, componentData: app.globalData.footerVal.componentData,
list: app.globalData.footerVal.componentData.list, list: app.globalData.footerVal.componentData.list,
mm:mm mm: mm
}); });
console.log('777777',Math.ceil(this.data.list.length/2-1),this.data.selected,this.data.componentData['styleSelectionNum']) console.log(
"777777",
Math.ceil(this.data.list.length / 2 - 1),
this.data.selected,
this.data.componentData["styleSelectionNum"]
);
} else { } else {
console.log(73333381) console.log(73333381);
app.footerCallBack = function(params) { app.footerCallBack = function(params) {
console.log('back') console.log("back");
that.setData({ that.setData({
componentData: params.componentData, componentData: params.componentData,
list: params.componentData.list, list: params.componentData.list
// mm:(Math.ceil(params.componentData.list.length/2-1)==that.data.selected&&params.componentData['styleSelectionNum']==1) // mm:(Math.ceil(params.componentData.list.length/2-1)==that.data.selected&&params.componentData['styleSelectionNum']==1)
}); });
let mm=(Math.ceil(params.componentData.list.length/2-1)==that.data.selected&&params.componentData['styleSelectionNum']==1) let mm =
console.log('87777777',mm) Math.ceil(params.componentData.list.length / 2 - 1) ==
that.data.selected &&
params.componentData["styleSelectionNum"] == 1;
console.log("87777777", mm);
}; };
} }
...@@ -133,9 +148,10 @@ Component({ ...@@ -133,9 +148,10 @@ Component({
// //
this.setData({ this.setData({
mm:(Math.ceil(this.data.list.length/2-1)==this.data.selected&&this.data.componentData['styleSelectionNum']==1) mm:
}) Math.ceil(this.data.list.length / 2 - 1) == this.data.selected &&
this.data.componentData["styleSelectionNum"] == 1
});
}, },
methods: { methods: {
init() {}, init() {},
......
...@@ -31,6 +31,10 @@ ...@@ -31,6 +31,10 @@
<!-- 名称 --> <!-- 名称 -->
<view class="text" style="color: {{selected === index ? componentData.selectTextColor : componentData.defaultTextColor}};font-size:{{selected === index ? componentData.selectionTextNum*2 : componentData.defaultTextNum*2}}rpx"> <view class="text" style="color: {{selected === index ? componentData.selectTextColor : componentData.defaultTextColor}};font-size:{{selected === index ? componentData.selectionTextNum*2 : componentData.defaultTextNum*2}}rpx">
{{item.title}}</view> {{item.title}}</view>
<!-- 购物车商品数量 -->
<view class="isCart" wx:if="{{item.link&&item.link.link&&item.link.link=='/shopCart/shoppingCart'&&cartNum>0}}">
{{cartNum}}
</view>
</view> </view>
</view> </view>
</view> </view>
......
...@@ -1492,3 +1492,17 @@ ...@@ -1492,3 +1492,17 @@
-ms-transform: translateY(0); -ms-transform: translateY(0);
-o-transform: translateY(0); -o-transform: translateY(0);
} }
.isCart{
width: 36rpx;
height: 36rpx;
background: var(--main-color);
position: absolute;
right: -8rpx;
top: 0;
color: #fff;
border-radius: 50%;
font-size: 24rpx;
text-align: center;
line-height: 36rpx;
z-index: 999;
}
\ No newline at end of file
...@@ -4,4 +4,7 @@ export default { ...@@ -4,4 +4,7 @@ export default {
addCart(data) { addCart(data) {
return requestPOST(`${process.env.OLSHOP_URL}/cart/add_item`, data); return requestPOST(`${process.env.OLSHOP_URL}/cart/add_item`, data);
}, },
} my_cart_count() {
\ No newline at end of file return requestPOST(`${process.env.OLSHOP_URL}/cart/my_cart_count`);
}
};
\ No newline at end of file
...@@ -6,6 +6,7 @@ import goodsApi from "./api/goods" ...@@ -6,6 +6,7 @@ import goodsApi from "./api/goods"
import orderApi from "./api/order" import orderApi from "./api/order"
import promoteApi from "./api/promote"; import promoteApi from "./api/promote";
import indexApi from './api/index' import indexApi from './api/index'
import cartApi from './api/cart'
import { DFSImg } from "@/utils/index"; import { DFSImg } from "@/utils/index";
import { $themeToLink, $themeAddToCard } from "@/utils/mayi"; import { $themeToLink, $themeAddToCard } from "@/utils/mayi";
import shop from "./api/shop"; import shop from "./api/shop";
...@@ -58,6 +59,7 @@ mpApp.goodsApi = goodsApi; ...@@ -58,6 +59,7 @@ mpApp.goodsApi = goodsApi;
mpApp.orderApi = orderApi; mpApp.orderApi = orderApi;
mpApp.promoteApi = promoteApi; mpApp.promoteApi = promoteApi;
mpApp.indexApi = indexApi; mpApp.indexApi = indexApi;
mpApp.cartApi = cartApi;
mpApp.DFSImg = DFSImg; mpApp.DFSImg = DFSImg;
mpApp.getThemePage = getThemePage mpApp.getThemePage = getThemePage
......
...@@ -264,6 +264,13 @@ export default { ...@@ -264,6 +264,13 @@ export default {
}, },
scrolltolower(){ scrolltolower(){
console.log("scrolltolower") console.log("scrolltolower")
},
getCartNum() {
app.cartApi.my_cart_count().then(res => {
if (res.data.code == 200) {
this.$mp.page.getTabBar().setData({"cartNum": Number(res.data.data)});
}
});
} }
}, },
onPullDownRefresh(){ onPullDownRefresh(){
......
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