update:新增砍价成功图片跳转店铺,新增砍价有效期倒计时时间戳

This commit is contained in:
lihaoyuan 2025-11-18 17:32:38 +08:00
parent 27d2d0b231
commit a0c6678a9e

View File

@ -47,7 +47,14 @@
</view> </view>
</view> </view>
<view class="part-bottom-sty"> <view class="part-bottom-sty">
<view :class="Info.can_buy_now==2?'time_fon_sty_reason1':'time_fon_sty_reason2'" >{{Info.cannot_buy_now_reason}}</view> <view
:class="
Info.can_buy_now == 2
? 'time_fon_sty_reason1'
: 'time_fon_sty_reason2'
"
>{{ Info.cannot_buy_now_reason }}</view
>
<view class="time_sty"> <view class="time_sty">
<view class="time_fon_sty"> <view class="time_fon_sty">
{{ __("活动时间仅剩") }} {{ __("活动时间仅剩") }}
@ -128,9 +135,15 @@
" "
> >
<!-- <view class="" @click="goshop">还差xx</view> --> <!-- <view class="" @click="goshop">还差xx</view> -->
<view class="immediately_btn" v-if="Info.can_buy_now==1" @click="goshop"></view>
<view <view
:class="Info.can_buy_now === 2 ? 'help_cut_btn2' : 'help_cut_btn'" class="immediately_btn"
v-if="Info.can_buy_now == 1"
@click="goshop"
></view>
<view
:class="
Info.can_buy_now === 2 ? 'help_cut_btn2' : 'help_cut_btn'
"
style="" style=""
v-if="Info.activity_state == 1" v-if="Info.activity_state == 1"
@click="shareBox" @click="shareBox"
@ -291,19 +304,22 @@
</view> </view>
<view :class="['msk']" @tap="back" v-if="showImg"> <view :class="['msk']" @tap="back" v-if="showImg">
<view class="msk_box"> <view class="msk_box">
<navigator
:url="'/pagesub/index/store?store_id=' + Info.store_id"
@tap.stop="goToStore"
>
<image <image
src="https://media-mall-prod-1259811287.cos.ap-guangzhou.myqcloud.com/static/xcxfile/appicon/cutprice-1/cut-price-animation.png" src="https://media-mall-prod-1259811287.cos.ap-guangzhou.myqcloud.com/static/xcxfile/appicon/cutprice-1/cut-price-animation.png"
style="width: 100%" style="width: 100%"
mode="widthFix" mode="widthFix"
@tap="back"
></image> ></image>
</navigator>
</view> </view>
</view> </view>
</view> </view>
<view class="u-tap-btn"> <view class="u-tap-btn">
<navigator <navigator
url="/pages/index/index" :url="'/pagesub/index/store?store_id=' + Info.store_id"
open-type="switchTab"
class="u-go-home" class="u-go-home"
> >
<view class="iconfont icon-shouyeshouye"></view> <view class="iconfont icon-shouyeshouye"></view>
@ -322,6 +338,7 @@
:shareDataDefault="shareData" :shareDataDefault="shareData"
ref="shareBoxApp" ref="shareBoxApp"
></share-box-app> ></share-box-app>
<loginPopup :show="showLoginPopup" @close="closeLoginPopup"></loginPopup>
</view> </view>
</template> </template>
@ -341,7 +358,7 @@ import { mapState, mapMutations } from "vuex";
import shareBoxMp from "../../components/share-box-mp.vue"; import shareBoxMp from "../../components/share-box-mp.vue";
import shareBoxApp from "../../components/share-box-app.vue"; import shareBoxApp from "../../components/share-box-app.vue";
import loginPopup from "@/components/loginPopup.vue";
export default { export default {
data() { data() {
return { return {
@ -390,11 +407,15 @@ export default {
href: "https://www.suteshop.com", href: "https://www.suteshop.com",
image: "", image: "",
}, },
showLoginPopup: false,
expiredAt: 0, // 0
countdownTimer: null, //
}; };
}, },
components: { components: {
shareBoxMp, shareBoxMp,
shareBoxApp, shareBoxApp,
loginPopup,
}, },
computed: mapState([ computed: mapState([
"Config", "Config",
@ -459,6 +480,10 @@ export default {
if (this.$refs.shareBoxApp.showBoxView) { if (this.$refs.shareBoxApp.showBoxView) {
this.$refs.shareBoxApp.cancel(); this.$refs.shareBoxApp.cancel();
} }
//
if (that.countdownTimer) {
clearInterval(that.countdownTimer);
}
}, },
methods: { methods: {
...mapMutations([ ...mapMutations([
@ -488,6 +513,10 @@ export default {
data: params, data: params,
success: function (data, status, msg, code) { success: function (data, status, msg, code) {
if (200 == status) { if (200 == status) {
//
if (data.expired_at) {
that.setData({ expiredAt: data.expired_at }); //
}
data.CutPricePercent = data.CutPricePercent =
(data.activity_rule.item_unit_price - data.ac_sale_price) / (data.activity_rule.item_unit_price - data.ac_sale_price) /
(data.activity_rule.item_unit_price - (data.activity_rule.item_unit_price -
@ -497,7 +526,8 @@ export default {
ac_id: data.ac_id, ac_id: data.ac_id,
width: 100 * parseFloat(data.CutPricePercent).toFixed(2), width: 100 * parseFloat(data.CutPricePercent).toFixed(2),
}); });
that.getTime(); // that.getTime();
that.startCountdown();
data.ac_sale_price - data.ac_mix_limit_price <= 0 data.ac_sale_price - data.ac_mix_limit_price <= 0
? that.setData({ ? that.setData({
isCut: false, isCut: false,
@ -520,6 +550,56 @@ export default {
}, },
}); });
}, },
closeLoginPopup() {
this.showLoginPopup = false;
},
// expired_at
startCountdown() {
var that = this;
//
if (that.countdownTimer) {
clearInterval(that.countdownTimer);
}
//
function updateCountdown() {
const now = new Date().getTime(); //
const expiredAt = that.expiredAt; //
const remainingTime = expiredAt - now; //
// 1<=0
if (remainingTime <= 0) {
that.setData({
Time: { hour: "00", min: "00", sec: "00" },
end: 3, //
});
clearInterval(that.countdownTimer); //
return;
}
// 2
const hours = Math.floor(remainingTime / 3600000); // 3600*1000
const minutes = Math.floor((remainingTime % 3600000) / 60000); // 60*1000
const seconds = Math.floor((remainingTime % 60000) / 1000); //
//
const formatHour = hours.toString().padStart(2, "0");
const formatMin = minutes.toString().padStart(2, "0");
const formatSec = seconds.toString().padStart(2, "0");
//
that.setData({
Time: { hour: formatHour, min: formatMin, sec: formatSec },
end: 2, //
});
}
//
updateCountdown();
// 1
that.countdownTimer = setInterval(updateCountdown, 1000);
},
getTime: function () { getTime: function () {
var e = this, var e = this,
t = new Date().getTime(), t = new Date().getTime(),
@ -668,8 +748,20 @@ export default {
}, },
bargin: function () { bargin: function () {
//
if (!this.hasLogin) {
this.showLoginPopup = true;
return;
}
this.CutPrice(); this.CutPrice();
}, },
//
goToStore() {
var that = this;
that.setData({ showImg: false });
that.GetVendorCutPriceEventDetail();
that.GetOtherCutPriceActivityList();
},
back: function () { back: function () {
this.setData({ this.setData({
showImg: false, showImg: false,
@ -690,6 +782,11 @@ export default {
} }
}, },
goshop: function () { goshop: function () {
//
if (!this.hasLogin) {
this.showLoginPopup = true;
return;
}
var e = this, var e = this,
params = { params = {
amount: 1, amount: 1,
@ -765,6 +862,11 @@ export default {
}); });
}, },
shareBox: function () { shareBox: function () {
//
if (!this.hasLogin) {
this.showLoginPopup = true;
return;
}
let that = this; let that = this;
// hrefwebview // hrefwebview
var $href = $.sprintf( var $href = $.sprintf(