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

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

View File

@ -47,8 +47,15 @@
</view>
</view>
<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="time_sty">
<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_fon_sty">
{{ __("活动时间仅剩") }}
</view>
@ -127,11 +134,17 @@
Info.order_id == ''
"
>
<!-- <view class="" @click="goshop">还差xx</view> -->
<view class="immediately_btn" v-if="Info.can_buy_now==1" @click="goshop"></view>
<!-- <view class="" @click="goshop">还差xx</view> -->
<view
:class="Info.can_buy_now === 2 ? 'help_cut_btn2' : 'help_cut_btn'"
style=""
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=""
v-if="Info.activity_state == 1"
@click="shareBox"
></view>
@ -273,7 +286,7 @@
</view>
</scroll-view>
</view>
<!-- <view style="display:flex; flex-direction: column; justify-content:center;align-items: center;">
<!-- <view style="display:flex; flex-direction: column; justify-content:center;align-items: center;">
<view>活动规则</view>
<textarea name="" id="" cols="30" rows="10">
砍价时间顾客发起活动后需要在规定时间内完成砍价超过时间则砍价失败一般建议时间为24小时
@ -291,19 +304,22 @@
</view>
<view :class="['msk']" @tap="back" v-if="showImg">
<view class="msk_box">
<image
src="https://media-mall-prod-1259811287.cos.ap-guangzhou.myqcloud.com/static/xcxfile/appicon/cutprice-1/cut-price-animation.png"
style="width: 100%"
mode="widthFix"
@tap="back"
></image>
<navigator
:url="'/pagesub/index/store?store_id=' + Info.store_id"
@tap.stop="goToStore"
>
<image
src="https://media-mall-prod-1259811287.cos.ap-guangzhou.myqcloud.com/static/xcxfile/appicon/cutprice-1/cut-price-animation.png"
style="width: 100%"
mode="widthFix"
></image>
</navigator>
</view>
</view>
</view>
<view class="u-tap-btn">
<navigator
url="/pages/index/index"
open-type="switchTab"
:url="'/pagesub/index/store?store_id=' + Info.store_id"
class="u-go-home"
>
<view class="iconfont icon-shouyeshouye"></view>
@ -322,6 +338,7 @@
:shareDataDefault="shareData"
ref="shareBoxApp"
></share-box-app>
<loginPopup :show="showLoginPopup" @close="closeLoginPopup"></loginPopup>
</view>
</template>
@ -341,7 +358,7 @@ import { mapState, mapMutations } from "vuex";
import shareBoxMp from "../../components/share-box-mp.vue";
import shareBoxApp from "../../components/share-box-app.vue";
import loginPopup from "@/components/loginPopup.vue";
export default {
data() {
return {
@ -390,11 +407,15 @@ export default {
href: "https://www.suteshop.com",
image: "",
},
showLoginPopup: false,
expiredAt: 0, // 0
countdownTimer: null, //
};
},
components: {
shareBoxMp,
shareBoxApp,
loginPopup,
},
computed: mapState([
"Config",
@ -459,6 +480,10 @@ export default {
if (this.$refs.shareBoxApp.showBoxView) {
this.$refs.shareBoxApp.cancel();
}
//
if (that.countdownTimer) {
clearInterval(that.countdownTimer);
}
},
methods: {
...mapMutations([
@ -488,6 +513,10 @@ export default {
data: params,
success: function (data, status, msg, code) {
if (200 == status) {
//
if (data.expired_at) {
that.setData({ expiredAt: data.expired_at }); //
}
data.CutPricePercent =
(data.activity_rule.item_unit_price - data.ac_sale_price) /
(data.activity_rule.item_unit_price -
@ -497,7 +526,8 @@ export default {
ac_id: data.ac_id,
width: 100 * parseFloat(data.CutPricePercent).toFixed(2),
});
that.getTime();
// that.getTime();
that.startCountdown();
data.ac_sale_price - data.ac_mix_limit_price <= 0
? that.setData({
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 () {
var e = this,
t = new Date().getTime(),
@ -668,8 +748,20 @@ export default {
},
bargin: function () {
//
if (!this.hasLogin) {
this.showLoginPopup = true;
return;
}
this.CutPrice();
},
//
goToStore() {
var that = this;
that.setData({ showImg: false });
that.GetVendorCutPriceEventDetail();
that.GetOtherCutPriceActivityList();
},
back: function () {
this.setData({
showImg: false,
@ -690,6 +782,11 @@ export default {
}
},
goshop: function () {
//
if (!this.hasLogin) {
this.showLoginPopup = true;
return;
}
var e = this,
params = {
amount: 1,
@ -765,6 +862,11 @@ export default {
});
},
shareBox: function () {
//
if (!this.hasLogin) {
this.showLoginPopup = true;
return;
}
let that = this;
// hrefwebview
var $href = $.sprintf(