diff --git a/package-lock.json b/package-lock.json index 828e5bf..4acba4f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,21 @@ "defer-to-connect": "^1.0.1" } }, + "@types/html5plus": { + "version": "1.0.1", + "resolved": "https://registry.npm.taobao.org/@types/html5plus/download/@types/html5plus-1.0.1.tgz", + "integrity": "sha1-EjFll+Qvb4fLJbnJOGD1fNObOQY=", + "dev": true + }, + "@types/uni-app": { + "version": "1.4.3", + "resolved": "https://registry.npm.taobao.org/@types/uni-app/download/@types/uni-app-1.4.3.tgz", + "integrity": "sha1-JRwBK9JAi2m/UB/g3I92rbOwV2w=", + "dev": true, + "requires": { + "vue": "^2.6.8" + } + }, "animate.css": { "version": "3.7.2", "resolved": "https://registry.npm.taobao.org/animate.css/download/animate.css-3.7.2.tgz", @@ -392,6 +407,12 @@ "prepend-http": "^2.0.0" } }, + "vue": { + "version": "2.6.12", + "resolved": "https://registry.npm.taobao.org/vue/download/vue-2.6.12.tgz", + "integrity": "sha1-9evU+mvShpQD4pqJau1JBEVskSM=", + "dev": true + }, "vue-ydui": { "version": "1.2.6", "resolved": "https://registry.npm.taobao.org/vue-ydui/download/vue-ydui-1.2.6.tgz", diff --git a/package.json b/package.json index 4dc3c88..8b20679 100644 --- a/package.json +++ b/package.json @@ -17,5 +17,9 @@ "miniapp-color-thief": "^1.0.5", "vue-ydui": "^1.2.6", "wechat-jssdk": "^5.0.4" + }, + "devDependencies": { + "@types/html5plus": "^1.0.1", + "@types/uni-app": "^1.4.3" } } diff --git a/pages/activity/GoodsSeckill/index.vue b/pages/activity/GoodsSeckill/index.vue index 7a2229b..9dc0081 100644 --- a/pages/activity/GoodsSeckill/index.vue +++ b/pages/activity/GoodsSeckill/index.vue @@ -46,9 +46,10 @@ </view> </view> <view class="grab bg-color-red" v-if="item.status === 1 && itemSeckill.stock > 0" - @click="goDetail(itemSeckill.id)">马上抢</view> + @click="goDetail(itemSeckill.id,item.status)">马上抢</view> <view class="grab" v-if="item.status === 1 && itemSeckill.stock <= 0">已售磬</view> - <view class="grab bg-color-red" @click="goDetail(itemSeckill.id)" v-if="item.status === 2">即将开始</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> </view> @@ -175,14 +176,15 @@ uni.hideLoading(); }); }, - goDetail: function (id) { + goDetail: function (id, status) { var that = this; var time = that.timeList[that.active].stop; this.$yrouter.push({ path: "/pages/activity/SeckillDetails/index", query: { id, - time + time, + status } }); } diff --git a/pages/activity/SeckillDetails/index.vue b/pages/activity/SeckillDetails/index.vue index 2ca96a4..6332601 100644 --- a/pages/activity/SeckillDetails/index.vue +++ b/pages/activity/SeckillDetails/index.vue @@ -58,7 +58,11 @@ <view class="iconfont icon-shoucang"></view> <text>收藏</text> </view> - <view class="bnt acea-row"> + <view class="bnt acea-row" v-if=" + seckillStatus == 1 && + storeInfo.num > 0 && + storeInfo.stock > 0 + "> <view class="joinCart" @click="openAlone"> <text>单独购买</text> </view> @@ -66,6 +70,24 @@ <text>立即购买</text> </view> </view> + + <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> + <div class="bnt acea-row" v-if="seckillStatus == 2"> + <div class="joinCart" @click="openAlone">原价购买</div> + <div class="buy bg-color-hui">即将开始</div> + </div> + <div class="bnt acea-row" v-if="seckillStatus == 0"> + <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> @@ -112,6 +134,7 @@ props: {}, data: function () { return { + seckillStatus: '', domStatus: false, posterData: { image: "", @@ -138,23 +161,15 @@ userCollect: false }; }, - watch: { - $yroute: function (n) { - var that = this; - if (n.name === NAME) { - that.mountedStart(); - } - } - }, - mounted: function () { + onShow: function () { this.mountedStart(); }, methods: { - onShareAppMessage: function() { + onShareAppMessage: function () { 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"), success(res) { uni.showToast({ title: '分享成功' @@ -199,7 +214,9 @@ }, mountedStart: function () { var that = 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 => { that.userCollect = res.data.userCollect;