|
@@ -74,7 +74,9 @@
|
|
|
<view class='coupon acea-row row-between-wrapper'>
|
|
|
<view class='hide line1 acea-row'>
|
|
|
赠积分:
|
|
|
- <view class='activity' v-if="storeInfo.obtainIntegral>0">赠送 {{ storeInfo.obtainIntegral }} 红积分</view>
|
|
|
+ <view class='activity' v-if="storeInfo.obtainIntegral > 0">赠送 {{
|
|
|
+ storeInfo.obtainIntegral
|
|
|
+ }} 红积分</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view v-if="couponList.length" class="coupon acea-row row-between-wrapper skeleton-rect"
|
|
@@ -198,15 +200,14 @@
|
|
|
</button>
|
|
|
</form>
|
|
|
</view>
|
|
|
- <view class="bnt acea-row" :class="!storeInfo.cart_button ? 'virbnt' : ''"
|
|
|
- v-else>
|
|
|
+ <view class="bnt acea-row" :class="!storeInfo.cart_button ? 'virbnt' : ''" v-else>
|
|
|
<form v-if="storeInfo.cart_button" @submit="joinCart" class="joinCart bnts"
|
|
|
:class="!storeInfo.cart_button ? 'virbnt' : ''">
|
|
|
<button class="joinCart bnts" form-type="submit">
|
|
|
{{ $t(`加入购物车`) }}
|
|
|
</button>
|
|
|
</form>
|
|
|
- <form class="buy bnts bg-color-hui" @submit="goBuy">
|
|
|
+ <form class="buy bnts bg-color-hui" @submit="goBuy">
|
|
|
<button class="buy bnts " form-type="submit"
|
|
|
:class="!storeInfo.cart_button ? 'virbnt' : ''">
|
|
|
{{ $t(`立即购买`) }}
|
|
@@ -292,7 +293,7 @@
|
|
|
<script>
|
|
|
let sysHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
|
|
|
import {
|
|
|
- getGoodsDetail, getUserAddressByUserId, postBeforeCheck ,getAvailableCheck
|
|
|
+ getGoodsDetail, getUserAddressByUserId, postBeforeCheck, getAvailableCheck
|
|
|
} from "@/api/home.js";
|
|
|
import {
|
|
|
getProductDetail,
|
|
@@ -412,7 +413,6 @@ export default {
|
|
|
sharePacket: {
|
|
|
isState: true, //默认不显示
|
|
|
}, //分销商详细
|
|
|
- uid: 0, //用户uid
|
|
|
circular: false,
|
|
|
autoplay: false,
|
|
|
interval: 3000,
|
|
@@ -466,7 +466,7 @@ export default {
|
|
|
svip_price_open: 1
|
|
|
};
|
|
|
},
|
|
|
- computed: mapGetters(["isLogin", "uid", "userInfo"]),
|
|
|
+ computed: mapGetters(["isLogin", "uid", "userInfo","selectAddr"]),
|
|
|
watch: {
|
|
|
isLogin: {
|
|
|
handler: function (newV, oldV) {
|
|
@@ -478,6 +478,12 @@ export default {
|
|
|
},
|
|
|
deep: true,
|
|
|
},
|
|
|
+ selectAddr: {
|
|
|
+ handler: function (newV, oldV) {
|
|
|
+ this.attrAddrValue = newV
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ },
|
|
|
storeInfo: {
|
|
|
handler: function () {
|
|
|
this.$nextTick(() => { });
|
|
@@ -487,8 +493,10 @@ export default {
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
// 判断是否登录
|
|
|
- if(!this.isLogin){
|
|
|
- this.$Cache.set('INVITE_CODE', options.inviteCode);
|
|
|
+ if (!this.isLogin) {
|
|
|
+ if (options.inviteCode != "undefined") {
|
|
|
+ this.$Cache.set('INVITE_CODE', options.inviteCode);
|
|
|
+ }
|
|
|
uni.showToast({
|
|
|
title: "您暂未登录,即将跳登录界面",
|
|
|
icon: 'none',
|
|
@@ -503,13 +511,15 @@ export default {
|
|
|
}
|
|
|
let userInfo = this.$Cache.get("USER_INFO", true)
|
|
|
console.log("用户自己的推荐码:" + userInfo.code);
|
|
|
- console.log("受邀的推荐码:"+ options.inviteCode);
|
|
|
+ console.log("受邀的推荐码:" + options.inviteCode);
|
|
|
//1580 进入时
|
|
|
- if(options.zoneType == 8){
|
|
|
+ if (options.zoneType == 8) {
|
|
|
//判断是否为自己的要求码进入
|
|
|
- if(options.inviteCode !== userInfo.code){
|
|
|
- this.$Cache.set('INVITE_CODE', options.inviteCode);
|
|
|
- }
|
|
|
+ if (options.inviteCode !== userInfo.code) {
|
|
|
+ if (options.inviteCode != "undefined") {
|
|
|
+ this.$Cache.set('INVITE_CODE', options.inviteCode);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
let that = this;
|
|
|
var pages = getCurrentPages();
|
|
@@ -854,9 +864,9 @@ export default {
|
|
|
this.storeInfo.salePrice = item.salePrice - 0
|
|
|
this.attr.productSelect.totalStock = item.stock - 0
|
|
|
this.attr.attrValueId = item.id
|
|
|
- if(!item.canSale){
|
|
|
+ if (!item.canSale) {
|
|
|
this.availableCheck = false
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
this.availableCheck = true
|
|
|
}
|
|
|
}
|
|
@@ -973,7 +983,7 @@ export default {
|
|
|
success: function () { },
|
|
|
});
|
|
|
},
|
|
|
- getUserAddressByUserId(){
|
|
|
+ getUserAddressByUserId() {
|
|
|
getUserAddressByUserId({
|
|
|
userId: this.$store.state.app.uid,
|
|
|
type: 1
|
|
@@ -988,9 +998,9 @@ export default {
|
|
|
*/
|
|
|
DefaultSelect: function () {
|
|
|
//找到第一个可销售的规格
|
|
|
- if(this.skuArr.length >= 0){
|
|
|
+ if (this.skuArr.length >= 0) {
|
|
|
this.skuArr.every(value => {
|
|
|
- if(value.canSale){
|
|
|
+ if (value.canSale) {
|
|
|
this.attrValue = value.spceName
|
|
|
this.storeInfo.obtainIntegral = value.obtainIntegral - 0
|
|
|
this.storeInfo.salePrice = value.salePrice - 0
|
|
@@ -1004,16 +1014,16 @@ export default {
|
|
|
uni.hideLoading();
|
|
|
},
|
|
|
// 可销售检测
|
|
|
- getAvailableCheck(){
|
|
|
+ getAvailableCheck() {
|
|
|
getAvailableCheck({
|
|
|
goodsInfoId: this.id,
|
|
|
userAddressId: this.attrAddrValue.id
|
|
|
}).then(res => {
|
|
|
//处理缺货的规格
|
|
|
let ban = res.data.ban
|
|
|
- if (ban !== undefined){
|
|
|
- this.storeInfo.goodsSpecList.forEach((value,key) =>{
|
|
|
- if(ban.includes(value.id-0) || ban.includes(value.optionId-0)){
|
|
|
+ if (ban !== undefined) {
|
|
|
+ this.storeInfo.goodsSpecList.forEach((value, key) => {
|
|
|
+ if (ban.includes(value.id - 0) || ban.includes(value.optionId - 0)) {
|
|
|
this.storeInfo.goodsSpecList[key].canSale = false
|
|
|
}
|
|
|
})
|
|
@@ -1152,7 +1162,14 @@ export default {
|
|
|
if (this.isLogin === false) {
|
|
|
toLogin();
|
|
|
} else {
|
|
|
- this.goCat();
|
|
|
+ //判断是否有地址
|
|
|
+ if(!this.attrAddrValue && !this.attrAddrValue.id){
|
|
|
+ this.goCat();
|
|
|
+ }else{
|
|
|
+ this.$util.Tips({
|
|
|
+ title: this.$t(`请先至个人中心设置默认地址`),
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
goCart() {
|
|
@@ -1206,7 +1223,7 @@ export default {
|
|
|
uni.navigateTo({
|
|
|
url: "/pages/goods/order_confirm/index?num=" + that.attr.productSelect.totalSales + "&productId=" +
|
|
|
that.attr.productSelect.id + "&addressId=" + that.attrAddrValue.id +
|
|
|
- "&goodsSpecId=" + that.attr.attrValueId+"&obtainIntegral="+that.storeInfo.obtainIntegral,
|
|
|
+ "&goodsSpecId=" + that.attr.attrValueId + "&obtainIntegral=" + that.storeInfo.obtainIntegral,
|
|
|
});
|
|
|
} else {
|
|
|
that.$util.Tips({
|
|
@@ -1259,7 +1276,14 @@ export default {
|
|
|
if (this.isLogin === false) {
|
|
|
toLogin();
|
|
|
} else {
|
|
|
- this.goCat(true);
|
|
|
+ //判断是否有地址
|
|
|
+ if(this.attrAddrValue && this.attrAddrValue.id){
|
|
|
+ this.goCat(true);
|
|
|
+ }else{
|
|
|
+ this.$util.Tips({
|
|
|
+ title: this.$t(`请先配置送至地址`),
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
open(data) {
|