商品0库存时没有提示,选择立即购买报错
This commit is contained in:
@ -2,18 +2,33 @@
|
||||
<view :class="productConClass">
|
||||
<view v-if="storeInfo.id">
|
||||
<!-- 轮播图 -->
|
||||
<product-con-swiper :img-urls="storeInfo.sliderImageArr"></product-con-swiper>
|
||||
<product-con-swiper
|
||||
:img-urls="storeInfo.sliderImageArr"
|
||||
></product-con-swiper>
|
||||
|
||||
<!-- 商品信息描述 -->
|
||||
<view class="wrapper">
|
||||
<view class="share acea-row row-between row-bottom">
|
||||
<view class="money font-color-red">
|
||||
<text>¥</text>
|
||||
<text class="num">{{ attr.productSelect.price || storeInfo.price }}</text>
|
||||
<text class="vip-money" v-if="storeInfo.vipPrice && storeInfo.vipPrice > 0">¥{{ attr.productSelect.vipPrice || storeInfo.vipPrice }}</text>
|
||||
<image src="@/static/images/vip.png" class="image" v-if="storeInfo.vipPrice && storeInfo.vipPrice > 0" />
|
||||
<text class="num">{{
|
||||
attr.productSelect.price || storeInfo.price
|
||||
}}</text>
|
||||
<text
|
||||
class="vip-money"
|
||||
v-if="storeInfo.vipPrice && storeInfo.vipPrice > 0"
|
||||
>¥{{ attr.productSelect.vipPrice || storeInfo.vipPrice }}</text
|
||||
>
|
||||
<image
|
||||
src="@/static/images/vip.png"
|
||||
class="image"
|
||||
v-if="storeInfo.vipPrice && storeInfo.vipPrice > 0"
|
||||
/>
|
||||
</view>
|
||||
<view class="iconfont icon-fenxiang" @click="listenerActionSheet"></view>
|
||||
<view
|
||||
class="iconfont icon-fenxiang"
|
||||
@click="listenerActionSheet"
|
||||
></view>
|
||||
</view>
|
||||
<view class="introduce">{{ storeInfo.storeName }}</view>
|
||||
<view class="label acea-row row-between-wrapper">
|
||||
@ -21,11 +36,19 @@
|
||||
<text>库存:{{ storeInfo.stock }}{{ storeInfo.unitName }}</text>
|
||||
<text>销量:{{ storeInfo.sales }}{{ storeInfo.unitName }}</text>
|
||||
</view>
|
||||
<view class="coupon acea-row row-between-wrapper" @click="couponTap" v-if="couponList.length">
|
||||
<view
|
||||
class="coupon acea-row row-between-wrapper"
|
||||
@click="couponTap"
|
||||
v-if="couponList.length"
|
||||
>
|
||||
<text class="hide line1">
|
||||
<text>优惠券:</text>
|
||||
<text class="activity" v-for="(item, couponListEq) in couponList"
|
||||
:key="couponListEq">满{{ item.useMinPrice }}减{{ item.couponPrice }}</text>
|
||||
<text
|
||||
class="activity"
|
||||
v-for="(item, couponListEq) in couponList"
|
||||
:key="couponListEq"
|
||||
>满{{ item.useMinPrice }}减{{ item.couponPrice }}</text
|
||||
>
|
||||
</text>
|
||||
<view class="iconfont icon-jiantou"></view>
|
||||
</view>
|
||||
@ -40,7 +63,10 @@
|
||||
</div>
|
||||
|
||||
<!-- 规格 -->
|
||||
<view class="attribute acea-row row-between-wrapper" @click="selecAttrTap">
|
||||
<view
|
||||
class="attribute acea-row row-between-wrapper"
|
||||
@click="selecAttrTap"
|
||||
>
|
||||
<view>
|
||||
<text>{{ attrTxt }}:</text>
|
||||
<text class="atterTxt">{{ attrValue }}</text>
|
||||
@ -64,14 +90,22 @@
|
||||
</view>
|
||||
<view class="text">
|
||||
<view class="name line1">{{ systemStore.name }}</view>
|
||||
<view class="address acea-row row-middle" @click="showChang(systemStore)">
|
||||
<view
|
||||
class="address acea-row row-middle"
|
||||
@click="showChang(systemStore)"
|
||||
>
|
||||
<text class="addressTxt">{{ systemStore.address }}</text>
|
||||
<text class="iconfont icon-youjian"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="addressBox">
|
||||
<a class="iconfont icon-dadianhua01 font-color-red phone" @click="telPhone(systemStore.phone)"></a>
|
||||
<view class="addressTxt corlor-yshop">距离{{systemStore.distance}}千米</view>
|
||||
<a
|
||||
class="iconfont icon-dadianhua01 font-color-red phone"
|
||||
@click="telPhone(systemStore.phone)"
|
||||
></a>
|
||||
<view class="addressTxt corlor-yshop"
|
||||
>距离{{ systemStore.distance }}千米</view
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -122,13 +156,13 @@
|
||||
<view class="conter" v-html="storeInfo.description"></view>
|
||||
</view>
|
||||
|
||||
<view style="height:100rpx;"></view>
|
||||
<view style="height: 100rpx"></view>
|
||||
<!-- 操作栏 -->
|
||||
<view class="footer acea-row row-between-wrapper">
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<view class="item">
|
||||
<button open-type="contact" class='contacButton'>
|
||||
<view style="padding-bottom: 8rpx;" class="item">
|
||||
<button open-type="contact" class="contacButton">
|
||||
<view style="padding-bottom: 8rpx" class="item">
|
||||
<view class="iconfont icon-kefu"></view>
|
||||
<text>客服</text>
|
||||
</view>
|
||||
@ -147,15 +181,23 @@
|
||||
<view class="iconfont icon-shoucang"></view>
|
||||
<text>收藏</text>
|
||||
</view>
|
||||
<view @click="goShoppingCart()" v-if="animated" class="item animated bounceIn">
|
||||
<view
|
||||
@click="goShoppingCart()"
|
||||
v-if="animated"
|
||||
class="item animated bounceIn"
|
||||
>
|
||||
<view class="iconfont icon-gouwuche1">
|
||||
<text class="num bg-color-red" v-if="CartCount > 0">{{CartCount}}</text>
|
||||
<text class="num bg-color-red" v-if="CartCount > 0">{{
|
||||
CartCount
|
||||
}}</text>
|
||||
</view>
|
||||
<text>购物车</text>
|
||||
</view>
|
||||
<view @click="goShoppingCart()" class="item animated" v-if="!animated">
|
||||
<view class="iconfont icon-gouwuche1">
|
||||
<text class="num bg-color-red" v-if="CartCount > 0">{{CartCount}}</text>
|
||||
<text class="num bg-color-red" v-if="CartCount > 0">{{
|
||||
CartCount
|
||||
}}</text>
|
||||
</view>
|
||||
<text>购物车</text>
|
||||
</view>
|
||||
@ -172,12 +214,23 @@
|
||||
<!-- 优惠券 -->
|
||||
<CouponPop v-on:changeFun="changeFun" :coupon="coupon"></CouponPop>
|
||||
<!-- 商品规格弹窗 -->
|
||||
<ProductWindow v-on:changeFun="changeFun" :attr="attr" :cartNum="cart_num"></ProductWindow>
|
||||
<ProductWindow
|
||||
v-on:changeFun="changeFun"
|
||||
:attr="attr"
|
||||
:cartNum="cart_num"
|
||||
></ProductWindow>
|
||||
<!-- 分享海报 -->
|
||||
<StorePoster v-on:setPosterImageStatus="setPosterImageStatus" :posterImageStatus="posterImageStatus"
|
||||
:posterData="posterData" :goodId="id"></StorePoster>
|
||||
<StorePoster
|
||||
v-on:setPosterImageStatus="setPosterImageStatus"
|
||||
:posterImageStatus="posterImageStatus"
|
||||
:posterData="posterData"
|
||||
:goodId="id"
|
||||
></StorePoster>
|
||||
<!-- 分享弹窗 -->
|
||||
<ShareInfo v-on:setShareInfoStatus="setShareInfoStatus" :shareInfoStatus="shareInfoStatus"></ShareInfo>
|
||||
<ShareInfo
|
||||
v-on:setShareInfoStatus="setShareInfoStatus"
|
||||
:shareInfoStatus="shareInfoStatus"
|
||||
></ShareInfo>
|
||||
|
||||
<view class="generate-posters acea-row row-middle on" v-if="posters">
|
||||
<view class="item" @click="setPosterImageStatus">
|
||||
@ -191,7 +244,12 @@
|
||||
<view>生成海报</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mask" @touchmove.prevent @click="listenerActionClose" v-show="posters"></view>
|
||||
<view
|
||||
class="mask"
|
||||
@touchmove.prevent
|
||||
@click="listenerActionClose"
|
||||
v-show="posters"
|
||||
></view>
|
||||
<view class="posterCanvasWarp">
|
||||
<canvas class="posterCanvas" canvas-id="myCanvas"></canvas>
|
||||
</view>
|
||||
@ -226,17 +284,11 @@
|
||||
PosterCanvas,
|
||||
handleQrCode,
|
||||
handleUrlParam,
|
||||
getCurrentPageUrlWithArgs
|
||||
getCurrentPageUrlWithArgs,
|
||||
} from "@/utils";
|
||||
import {
|
||||
wechatEvevt
|
||||
} from "@/libs/wechat";
|
||||
import {
|
||||
imageBase64
|
||||
} from "@/api/public";
|
||||
import {
|
||||
mapGetters
|
||||
} from "vuex";
|
||||
import { wechatEvevt } from "@/libs/wechat";
|
||||
import { imageBase64 } from "@/api/public";
|
||||
import { mapGetters } from "vuex";
|
||||
|
||||
export default {
|
||||
name: "GoodsCon",
|
||||
@ -311,7 +363,7 @@
|
||||
this.$store.commit("get_to", "goodcon");
|
||||
let url = handleQrCode();
|
||||
if (!url) {
|
||||
url = handleUrlParam(getCurrentPageUrlWithArgs())
|
||||
url = handleUrlParam(getCurrentPageUrlWithArgs());
|
||||
}
|
||||
this.coupons();
|
||||
if (url && url.id) {
|
||||
@ -341,20 +393,24 @@
|
||||
return {
|
||||
title: this.storeInfo.storeName,
|
||||
imageUrl: this.storeInfo.image,
|
||||
path: "pages/shop/GoodsCon/index?id=" + this.storeInfo.id + "&spread=" + uni.getStorageSync("uid") +
|
||||
path:
|
||||
"pages/shop/GoodsCon/index?id=" +
|
||||
this.storeInfo.id +
|
||||
"&spread=" +
|
||||
uni.getStorageSync("uid") +
|
||||
"&pageType=good&codeType=routine",
|
||||
success(res) {
|
||||
uni.showToast({
|
||||
title: '分享成功'
|
||||
})
|
||||
title: "分享成功",
|
||||
});
|
||||
},
|
||||
fail(res) {
|
||||
uni.showToast({
|
||||
title: '分享失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}
|
||||
title: "分享失败",
|
||||
icon: "none",
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
goHome() {
|
||||
this.$yrouter.switchTab("/pages/home/index");
|
||||
@ -385,7 +441,7 @@
|
||||
phoneNumber: phoneNumber,
|
||||
fail() {
|
||||
console.log("取消拨打");
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
showChang: function (data) {
|
||||
@ -421,7 +477,7 @@
|
||||
}
|
||||
uni.showLoading({
|
||||
title: "加载中",
|
||||
mask: true
|
||||
mask: true,
|
||||
});
|
||||
getProductDetail(that.id, from)
|
||||
.then((res) => {
|
||||
@ -467,7 +523,8 @@
|
||||
})
|
||||
.catch((err) => {
|
||||
uni.showToast({
|
||||
title: err.msg || err.response.data.msg || err.response.data.message,
|
||||
title:
|
||||
err.msg || err.response.data.msg || err.response.data.message,
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
@ -594,7 +651,6 @@
|
||||
limit: 20,
|
||||
};
|
||||
getCoupon(q).then((res) => {
|
||||
|
||||
that.$set(that, "couponList", res.data || []);
|
||||
that.$set(that.coupon, "list", res.data);
|
||||
});
|
||||
@ -615,7 +671,7 @@
|
||||
// 修改了规格
|
||||
|
||||
let productSelect = this.productValue[res.value];
|
||||
console.log(productSelect)
|
||||
console.log(productSelect);
|
||||
if (productSelect) {
|
||||
this.attr.productAttr[res.indexw].index = res.indexn;
|
||||
this.$set(this.attr.productSelect, "image", productSelect.image);
|
||||
@ -687,14 +743,25 @@
|
||||
productId: that.id,
|
||||
cartNum: that.attr.productSelect.cart_num,
|
||||
new: news,
|
||||
uniqueId: that.attr.productSelect !== undefined ?
|
||||
that.attr.productSelect.unique : "",
|
||||
uniqueId:
|
||||
that.attr.productSelect !== undefined
|
||||
? that.attr.productSelect.unique
|
||||
: "",
|
||||
};
|
||||
postCartAdd(q)
|
||||
.then(function (res) {
|
||||
that.isOpen = false;
|
||||
that.attr.cartAttr = false;
|
||||
if (news) {
|
||||
if (!res.data) {
|
||||
uni.showToast({
|
||||
title:
|
||||
res.msg || res.data.msg || res.data.message,
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
return;
|
||||
}
|
||||
that.$yrouter.push({
|
||||
path: "/pages/order/OrderSubmission/index",
|
||||
query: {
|
||||
@ -761,9 +828,9 @@
|
||||
if (this.isLogin) {
|
||||
getUserInfo().then((res) => {
|
||||
href =
|
||||
href.indexOf("?") === -1 ?
|
||||
href + "?spread=" + res.data.uid :
|
||||
href + "&spread=" + res.data.uid;
|
||||
href.indexOf("?") === -1
|
||||
? href + "?spread=" + res.data.uid
|
||||
: href + "&spread=" + res.data.uid;
|
||||
var configAppMessage = {
|
||||
desc: data.storeInfo,
|
||||
title: data.storeName,
|
||||
@ -774,11 +841,8 @@
|
||||
["updateAppMessageShareData", "updateTimelineShareData"],
|
||||
configAppMessage
|
||||
)
|
||||
.then((res) => {
|
||||
|
||||
})
|
||||
.then((res) => {})
|
||||
.catch((res) => {
|
||||
|
||||
if (res.is_ready) {
|
||||
res.wx.updateAppMessageShareData(configAppMessage);
|
||||
res.wx.updateTimelineShareData(configAppMessage);
|
||||
@ -796,11 +860,8 @@
|
||||
["updateAppMessageShareData", "updateTimelineShareData"],
|
||||
configAppMessage
|
||||
)
|
||||
.then((res) => {
|
||||
|
||||
})
|
||||
.then((res) => {})
|
||||
.catch((res) => {
|
||||
|
||||
if (res.is_ready) {
|
||||
res.wx.updateAppMessageShareData(configAppMessage);
|
||||
res.wx.updateTimelineShareData(configAppMessage);
|
||||
@ -981,8 +1042,6 @@
|
||||
filter: blur(2px);
|
||||
}
|
||||
|
||||
|
||||
|
||||
.product-con .product-intro .conter view {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
Reference in New Issue
Block a user