修改秒杀详情无法更改数量的问题
This commit is contained in:
@ -50,7 +50,7 @@
|
||||
<view class="grab" v-if="item.status === 1 && itemSeckill.stock <= 0">已售磬</view>
|
||||
<view class="grab bg-color-red" @click="goDetail(itemSeckill.id,item.status)" v-if="item.status === 2">即将开始
|
||||
</view>
|
||||
<view class="grab bg-color-red" v-if="item.status === 0">已结束</view>
|
||||
<view class="grab bg-color-red" @click="goDetail(itemSeckill.id,item.status)" v-if="item.status === 0">已结束</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="noCommodity" style="background-color: #f5f5f5;" v-if="seckillList.length === 0 && page > 1">
|
||||
|
@ -1,5 +1,8 @@
|
||||
<template>
|
||||
<view :class="[posterImageStatus ? 'noscroll product-con' : 'product-con']" v-show="domStatus">
|
||||
<view
|
||||
:class="[posterImageStatus ? 'noscroll product-con' : 'product-con']"
|
||||
v-show="domStatus"
|
||||
>
|
||||
<product-con-swiper :imgUrls="imgUrls"></product-con-swiper>
|
||||
<view class="nav acea-row row-between-wrapper">
|
||||
<view class="money">
|
||||
@ -10,8 +13,15 @@
|
||||
<view class="acea-row row-middle">
|
||||
<view class="times">
|
||||
<view>距秒杀结束仅剩</view>
|
||||
<count-down :isDay="false" :tipText="' '" :dayText="' '" :hourText="' : '" :minuteText="' : '"
|
||||
:secondText="' '" :datatime="datatime/1000"></count-down>
|
||||
<count-down
|
||||
:isDay="false"
|
||||
:tipText="' '"
|
||||
:dayText="' '"
|
||||
:hourText="' : '"
|
||||
:minuteText="' : '"
|
||||
:secondText="' '"
|
||||
:datatime="datatime / 1000"
|
||||
></count-down>
|
||||
</view>
|
||||
<view class="iconfont icon-jiantou"></view>
|
||||
</view>
|
||||
@ -40,12 +50,12 @@
|
||||
</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>
|
||||
@ -60,11 +70,10 @@
|
||||
<view class="iconfont icon-shoucang"></view>
|
||||
<text>收藏</text>
|
||||
</view>
|
||||
<view class="bnt acea-row" v-if="
|
||||
seckillStatus == 1 &&
|
||||
storeInfo.num > 0 &&
|
||||
storeInfo.stock > 0
|
||||
">
|
||||
<view
|
||||
class="bnt acea-row"
|
||||
v-if="seckillStatus == 1 && storeInfo.num > 0 && storeInfo.stock > 0"
|
||||
>
|
||||
<view class="joinCart" @click="openAlone">
|
||||
<text>单独购买</text>
|
||||
</view>
|
||||
@ -73,11 +82,10 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<div class="bnt acea-row" v-if="
|
||||
seckillStatus == 1 &&
|
||||
storeInfo.num <= 0 &&
|
||||
storeInfo.stock <= 0
|
||||
">
|
||||
<div
|
||||
class="bnt acea-row"
|
||||
v-if="seckillStatus == 1 && storeInfo.num <= 0 && storeInfo.stock <= 0"
|
||||
>
|
||||
<div class="joinCart" @click="openAlone">原价购买</div>
|
||||
<div class="buy bg-color-hui">已售罄</div>
|
||||
</div>
|
||||
@ -89,12 +97,18 @@
|
||||
<div class="joinCart" @click="openAlone">原价购买</div>
|
||||
<div class="buy bg-color-hui">已结束</div>
|
||||
</div>
|
||||
|
||||
</view>
|
||||
|
||||
<ProductWindow v-on:changeFun="changeFun" :attr="attr" :cartNum="cartNum"></ProductWindow>
|
||||
<StorePoster v-on:setPosterImageStatus="setPosterImageStatus" :posterImageStatus="posterImageStatus"
|
||||
:posterData="posterData"></StorePoster>
|
||||
<ProductWindow
|
||||
v-on:changeFun="changeFun"
|
||||
:attr="attr"
|
||||
:cartNum="cartNum"
|
||||
></ProductWindow>
|
||||
<StorePoster
|
||||
v-on:setPosterImageStatus="setPosterImageStatus"
|
||||
:posterImageStatus="posterImageStatus"
|
||||
:posterData="posterData"
|
||||
></StorePoster>
|
||||
</view>
|
||||
</template>
|
||||
<style scoped lang="less">
|
||||
@ -108,20 +122,14 @@
|
||||
import CountDown from "@/components/CountDown";
|
||||
import ProductWindow from "@/components/ProductWindow";
|
||||
import StorePoster from "@/components/StorePoster";
|
||||
import {
|
||||
getSeckillDetail
|
||||
} from "@/api/activity";
|
||||
import {
|
||||
postCartAdd
|
||||
} from "@/api/store";
|
||||
import {
|
||||
imageBase64
|
||||
} from "@/api/public";
|
||||
import { getSeckillDetail } from "@/api/activity";
|
||||
import { postCartAdd } from "@/api/store";
|
||||
import { imageBase64 } from "@/api/public";
|
||||
import {
|
||||
getCoupon,
|
||||
getCollectAdd,
|
||||
getCollectDel,
|
||||
getUserInfo
|
||||
getUserInfo,
|
||||
} from "@/api/user";
|
||||
const NAME = "SeckillDetails";
|
||||
|
||||
@ -131,18 +139,18 @@
|
||||
ProductConSwiper,
|
||||
CountDown,
|
||||
ProductWindow,
|
||||
StorePoster
|
||||
StorePoster,
|
||||
},
|
||||
props: {},
|
||||
data: function () {
|
||||
return {
|
||||
seckillStatus: '',
|
||||
seckillStatus: "",
|
||||
domStatus: false,
|
||||
posterData: {
|
||||
image: "",
|
||||
title: "",
|
||||
price: "",
|
||||
code: ""
|
||||
code: "",
|
||||
},
|
||||
posterImageStatus: false,
|
||||
action: "",
|
||||
@ -160,7 +168,7 @@
|
||||
productSelect: {},
|
||||
},
|
||||
datatime: 0,
|
||||
userCollect: false
|
||||
userCollect: false,
|
||||
};
|
||||
},
|
||||
onShow: function () {
|
||||
@ -171,34 +179,38 @@
|
||||
return {
|
||||
title: this.storeInfo.title,
|
||||
imageUrl: this.storeInfo.image,
|
||||
path: "pages/activity/GoodsSeckill/index?id=" + this.storeInfo.id + "&spread=" + uni.getStorageSync("uid") +
|
||||
path:
|
||||
"pages/activity/GoodsSeckill/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",
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
openAlone: function () {
|
||||
this.$yrouter.push({
|
||||
path: "/pages/shop/GoodsCon/index",
|
||||
query: {
|
||||
id: this.storeInfo.productId
|
||||
}
|
||||
id: this.storeInfo.productId,
|
||||
},
|
||||
});
|
||||
// this.$yrouter.replace({ path: "/detail/" + this.storeInfo.productId });
|
||||
},
|
||||
routerGo(item) {
|
||||
this.$yrouter.push({
|
||||
path: '/pages/user/CustomerList/index'
|
||||
})
|
||||
path: "/pages/user/CustomerList/index",
|
||||
});
|
||||
},
|
||||
//收藏商品
|
||||
setCollect: function () {
|
||||
@ -217,11 +229,11 @@
|
||||
},
|
||||
mountedStart: function () {
|
||||
var that = this;
|
||||
console.log(this)
|
||||
console.log(this);
|
||||
let id = that.$yroute.query.id;
|
||||
this.seckillStatus = that.$yroute.query.status;
|
||||
that.datatime = parseInt(that.$yroute.query.time);
|
||||
getSeckillDetail(id).then(res => {
|
||||
getSeckillDetail(id).then((res) => {
|
||||
that.userCollect = res.data.userCollect;
|
||||
res.data.storeInfo.description = res.data.storeInfo.description.replace(
|
||||
/\<img/gi,
|
||||
@ -245,7 +257,6 @@
|
||||
// that.setProductSelect();
|
||||
that.domStatus = true;
|
||||
that.DefaultSelect();
|
||||
|
||||
});
|
||||
},
|
||||
updateTitle() {
|
||||
@ -265,13 +276,9 @@
|
||||
}
|
||||
//sort();排序函数:数字-英文-汉字;
|
||||
let productSelect = this.productValue[value.sort().join(",")];
|
||||
console.log(productSelect)
|
||||
console.log(productSelect);
|
||||
if (productSelect && productAttr.length) {
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
"store_name",
|
||||
this.storeInfo.title
|
||||
);
|
||||
this.$set(this.attr.productSelect, "store_name", this.storeInfo.title);
|
||||
this.$set(this.attr.productSelect, "image", productSelect.image);
|
||||
this.$set(this.attr.productSelect, "price", productSelect.seckillPrice);
|
||||
this.$set(this.attr.productSelect, "stock", productSelect.seckillStock);
|
||||
@ -280,27 +287,31 @@
|
||||
this.$set(this, "attrValue", value.sort().join(","));
|
||||
this.$set(this, "attrTxt", "已选择");
|
||||
} else if (!productSelect && productAttr.length) {
|
||||
this.$set(this.attr.productSelect, "store_name", this.storeInfo.title);
|
||||
this.$set(this.attr.productSelect, "image", this.storeInfo.image);
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
"store_name",
|
||||
this.storeInfo.title
|
||||
"price",
|
||||
this.storeInfo.seckillPrice
|
||||
);
|
||||
this.$set(this.attr.productSelect, "image", this.storeInfo.image);
|
||||
this.$set(this.attr.productSelect, "price", this.storeInfo.seckillPrice);
|
||||
this.$set(this.attr.productSelect, "stock", 0);
|
||||
this.$set(this.attr.productSelect, "unique", "");
|
||||
this.$set(this.attr.productSelect, "cart_num", 0);
|
||||
this.$set(this, "attrValue", "");
|
||||
this.$set(this, "attrTxt", "请选择");
|
||||
} else if (!productSelect && !productAttr.length) {
|
||||
this.$set(this.attr.productSelect, "store_name", this.storeInfo.title);
|
||||
this.$set(this.attr.productSelect, "image", this.storeInfo.image);
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
"store_name",
|
||||
this.storeInfo.title
|
||||
"price",
|
||||
this.storeInfo.seckillPrice
|
||||
);
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
"stock",
|
||||
this.storeInfo.seckillStock
|
||||
);
|
||||
this.$set(this.attr.productSelect, "image", this.storeInfo.image);
|
||||
this.$set(this.attr.productSelect, "price", this.storeInfo.seckillPrice);
|
||||
this.$set(this.attr.productSelect, "stock", this.storeInfo.seckillStock);
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
"unique",
|
||||
@ -322,17 +333,50 @@
|
||||
var that = this;
|
||||
that.attr.cartAttr = res;
|
||||
},
|
||||
ChangeCartNum: function (res) {
|
||||
var that = this;
|
||||
if (res) {
|
||||
if (that.attr.productSelect.cart_num < that.storeInfo.seckillStock) {
|
||||
that.attr.productSelect.cart_num++;
|
||||
this.cartNum++;
|
||||
// ChangeCartNum: function (res) {
|
||||
// var that = this;
|
||||
// if (res) {
|
||||
// if (that.attr.productSelect.cart_num < that.storeInfo.seckillStock) {
|
||||
// that.attr.productSelect.cart_num += 1;
|
||||
// this.cartNum += 1;
|
||||
// console.log(this.cartNum)
|
||||
// }
|
||||
// } else {
|
||||
// if (that.attr.productSelect.cart_num > 1) {
|
||||
// that.attr.productSelect.cart_num -= 1;
|
||||
// this.cartNum -= 1;
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
ChangeCartNum: function (changeValue) {
|
||||
//changeValue:是否 加|减
|
||||
//获取当前变动属性
|
||||
let productSelect = this.productValue[this.attrValue];
|
||||
//如果没有属性,赋值给商品默认库存
|
||||
if (productSelect === undefined && !this.attr.productAttr.length) {
|
||||
productSelect = this.attr.productSelect;
|
||||
}
|
||||
//无属性值即库存为0;不存在加减;
|
||||
if (productSelect === undefined) return;
|
||||
let stock = productSelect.stock || 0;
|
||||
let num = this.attr.productSelect;
|
||||
if (changeValue) {
|
||||
num.cart_num++;
|
||||
if (num.cart_num > stock) {
|
||||
this.$set(this.attr.productSelect, "cart_num", stock);
|
||||
this.$set(this, "cartNum", stock);
|
||||
} else {
|
||||
this.$set(this.attr.productSelect, "cart_num", num.cart_num);
|
||||
this.$set(this, "cartNum", num.cart_num);
|
||||
}
|
||||
} else {
|
||||
if (that.attr.productSelect.cart_num > 1) {
|
||||
that.attr.productSelect.cart_num--;
|
||||
this.cartNum--;
|
||||
num.cart_num--;
|
||||
if (num.cart_num < 1) {
|
||||
this.$set(this.attr.productSelect, "cart_num", 1);
|
||||
this.$set(this, "cartNum", 1);
|
||||
} else {
|
||||
this.$set(this.attr.productSelect, "cart_num", num.cart_num);
|
||||
this.$set(this, "cartNum", num.cart_num);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -351,7 +395,11 @@
|
||||
this.$set(this, "attrTxt", "已选择");
|
||||
} else {
|
||||
this.$set(this.attr.productSelect, "image", this.storeInfo.image);
|
||||
this.$set(this.attr.productSelect, "price", this.storeInfo.seckillPrice);
|
||||
this.$set(
|
||||
this.attr.productSelect,
|
||||
"price",
|
||||
this.storeInfo.seckillPrice
|
||||
);
|
||||
this.$set(this.attr.productSelect, "stock", 0);
|
||||
this.$set(this.attr.productSelect, "unique", "");
|
||||
this.$set(this.attr.productSelect, "cart_num", 0);
|
||||
@ -375,24 +423,25 @@
|
||||
data.secKillId = that.storeInfo.id;
|
||||
data.new = 1;
|
||||
postCartAdd(data)
|
||||
.then(res => {
|
||||
.then((res) => {
|
||||
that.$yrouter.push({
|
||||
path: "/pages/order/OrderSubmission/index",
|
||||
query: {
|
||||
id: res.data.cartId
|
||||
}
|
||||
id: res.data.cartId,
|
||||
},
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
.catch((err) => {
|
||||
uni.showToast({
|
||||
title: err.msg || err.response.data.msg || err.response.data.message,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
title:
|
||||
err.msg || err.response.data.msg || err.response.data.message,
|
||||
icon: "none",
|
||||
duration: 2000,
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
@ -402,6 +451,5 @@
|
||||
|
||||
.product-con .footer .bnt .buy.bg-color-hui {
|
||||
background: #ccc;
|
||||
|
||||
}
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user