Commit 39db9abf by weijiguang

修复bug

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