Commit 39db9abf by weijiguang

修复bug

parent 4bf5da33
......@@ -10,7 +10,7 @@
<scroll-view class="nav-right" scroll-y :scroll-top="scrollTop" @scroll="scroll" @touchstart="openScroll"
scroll-with-animation>
<view v-for="category in classifyData" :id="category.id" :key="category.id" class="box">
<view :style="loads" class="right-title">{{ category.name }}</view>
<view v-if="category.goods && category.goods.length>0" :style="loads" class="right-title">{{ category.name }}</view>
<view class="nav-right-item" v-for="item in category.goods" :key="item.goodsId">
<image src="../../static/imgs/isRecommend.png" v-if="item.isRecommend == 1" class="isRecommend" />
<image @click="cart(item, category)" class="thumbnail" v-if="item.pics.thumbnailApplet" :src="item.pics.thumbnailApplet" />
......
......@@ -74,14 +74,8 @@
<div class="price">总优惠¥{{ reduction }}</div>
</div> -->
</div>
<view class="payment" @click="messageAndSave" v-if="userms">
付款
</view>
<button v-if="!userms" class="payment" style="border-radius: 0;" open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber">
付款
</button>
<view class="payment" @click="messageAndSave" v-if="userms">付款</view>
<button v-if="!userms" class="payment" style="border-radius: 0;" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">付款</button>
</div>
</view>
</template>
......@@ -102,7 +96,6 @@ export default {
this.duration = data.data
})
}
},
onLoad(option) {
// 商品详情页点击立即支付进入
......@@ -120,19 +113,19 @@ export default {
this.option = JSON.stringify(option)
const { q } = option;
if (q) {
User.getLocation((location) => {
User.getLocation((state, params) => {
uni.removeStorageSync('shopCarInfo');
$EventBus.$emit('updateCar');
// this.buyType = '1';
let id = decodeURIComponent(q).split('?')[1].split('=')[1];
Menu.getScreenShopCar(id, location).then(res => {
Menu.getScreenShopCar(id, params).then(res => {
const data = JSON.parse(res.data.data);
console.log(data);
this.shopData = data.shop;
this.buyType = data.screenNo;
this.goods = data.goods.map(item => {
const data = { ...item, skuId: item.sku.skuId, flag: true }
Utils.getallNum(data)
Utils.getallNum(data, true) // 不校验数量
return data
})
})
......@@ -153,7 +146,6 @@ export default {
this.duration = data.data
})
if(!this.userms){
User.wxLoginAndGetOpenid(true).then(loginInfo=>{
this.loginInfo = loginInfo
......
......@@ -7,7 +7,7 @@
<text @click="showArea" class="shop-name">{{ shopInfo.name }}</text>
<u-icon name="arrow-right" class="arrow-right-select" color="#FFFFFF"></u-icon>
</view>
<view v-if="shopInfo.distance" class="distance">距您{{ shopInfo.distance }}</view>
<view v-if="shopInfo.distance && shopInfo.distance!=-1" class="distance">距您{{ shopInfo.distance }}</view>
</view>
<view class="login-area">
<view class="avatar">
......@@ -234,7 +234,7 @@ export default {
},
async getMenuList(id) {
let { data } = await Menu.getMenuList(id);
console.log("menus:"+JSON.stringify(data));
// console.log("menus:"+JSON.stringify(data));
if (data.code == 200) {
data.data = data.data;
this.$store.commit('setMenuAllInfo', data.data);
......
......@@ -30,7 +30,7 @@ export default {
getShopInfo(params) {
return uni.$u.http.get('/weixin/getShop', { params })
.then((res) => {
console.log("get shop:"+JSON.stringify(res.data.data));
// console.log("get shop:"+JSON.stringify(res.data.data));
if (res.data.code == 200) {
Store.commit('saveShopInfo', res.data.data);
uni.setStorage({ key: 'shopData', data: res.data.data });
......
......@@ -42,11 +42,13 @@ export default {
}
},
// 加入购物车数据
async getallNum(Obj, callback) {
async getallNum(Obj, unCheckCount) {
console.log(Obj);
let shopCarInfo = uni.getStorageSync('shopCarInfo') || [];
let size = 0;
shopCarInfo.forEach((item) => (size += item.num));
if(!unCheckCount) {
let countOfOrder = uni.getStorageSync('countOfOrder');
if (size >= countOfOrder) {
uni.showToast({
......@@ -55,6 +57,7 @@ export default {
});
return false;
}
}
if (shopCarInfo) {
let currentGoods = shopCarInfo.find((v) => v.goodsId == Obj.goodsId && v.skuId == Obj.skuId);
......@@ -69,9 +72,9 @@ export default {
console.log(Obj);
uni.setStorageSync('shopCarInfo', shopCarInfo);
$EventBus.$emit('updateCar');
if (callback) {
callback();
}
// if (callback) {
// callback();
// }
},
// 商品详情立即购买
async addGoods(Obj) {
......
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