修改为你推荐显示旧价格的问题

This commit is contained in:
Gao xiaosong
2021-06-09 23:13:29 +08:00
parent c2d0529ab5
commit 1b141d0256
2 changed files with 331 additions and 328 deletions

View File

@ -19,8 +19,7 @@
<view class="title more-t">{{ item.storeName }}</view> <view class="title more-t">{{ item.storeName }}</view>
<view class="price-box"> <view class="price-box">
<view class="flex x-bc align-end"> <view class="flex x-bc align-end">
<view class="current">{{ item.activity_type === 'groupon' ? item.price : item.otPrice }} <view class="current">{{ item.price }} </view>
</view>
<view class="sales miso-font">仅剩{{ item.stock }}{{ item.unitName }}</view> <view class="sales miso-font">仅剩{{ item.stock }}{{ item.unitName }}</view>
</view> </view>
<view class="x-f tag-box"> <view class="x-f tag-box">
@ -33,36 +32,34 @@
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
export default { export default {
name: 'PromotionGood', name: 'PromotionGood',
props: ['benefit'], props: ['benefit'],
data: function () { data: function() {
return {}; return {}
}, },
methods: { methods: {
routerGo(item) { routerGo(item) {
this.$yrouter.push({ this.$yrouter.push({
path: '/pages/shop/GoodsCon/index', path: '/pages/shop/GoodsCon/index',
query: { query: {
id: item.id id: item.id,
}
});
}
}, },
mounted() { })
} },
}; },
mounted() {},
}
</script> </script>
<style lang="scss"> <style lang="scss">
.sh-title-card { .sh-title-card {
width: 750rpx; width: 750rpx;
} }
.title-box { .title-box {
width: 710rpx; width: 710rpx;
height: 88rpx; height: 88rpx;
margin: 0 auto; margin: 0 auto;
@ -81,9 +78,9 @@
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
font-weight: bold; font-weight: bold;
} }
} }
.goods-box { .goods-box {
width: 345rpx; width: 345rpx;
background: #fff; background: #fff;
padding-bottom: 20rpx; padding-bottom: 20rpx;
@ -188,10 +185,10 @@
} }
} }
} }
} }
// 为你推荐 // 为你推荐
.hot-goods { .hot-goods {
// background: linear-gradient(#fff 200rpx, #f6f6f6 500rpx, #f6f6f6); // background: linear-gradient(#fff 200rpx, #f6f6f6 500rpx, #f6f6f6);
// border-radius: 20rpx; // border-radius: 20rpx;
@ -211,5 +208,5 @@
} }
} }
} }
} }
</style> </style>

View File

@ -13,42 +13,40 @@
</view> </view>
</template> </template>
<script> <script>
// import { swiper, swiperSlide } from "vue-awesome-swiper"; // import { swiper, swiperSlide } from "vue-awesome-swiper";
import { import { getSpreadImg } from '@/api/user'
getSpreadImg
} from "@/api/user";
export default { export default {
name: "Poster", name: 'Poster',
components: { components: {
// swiper, // swiper,
// swiperSlide // swiperSlide
}, },
props: {}, props: {},
data: function () { data: function() {
return { return {
swiperPosters: { swiperPosters: {
speed: 1000, speed: 1000,
effect: "coverflow", effect: 'coverflow',
slidesPerView: "auto", slidesPerView: 'auto',
centeredSlides: true, centeredSlides: true,
coverflowEffect: { coverflowEffect: {
rotate: 0, // 旋转的角度 rotate: 0, // 旋转的角度
stretch: -20, // 拉伸 图片间左右的间距和密集度 stretch: -20, // 拉伸 图片间左右的间距和密集度
depth: 100, // 深度 切换图片间上下的间距和密集度 depth: 100, // 深度 切换图片间上下的间距和密集度
modifier: 3, // 修正值 该值越大前面的效果越明显 modifier: 3, // 修正值 该值越大前面的效果越明显
slideShadows: false // 页面阴影效果 slideShadows: false, // 页面阴影效果
}, },
observer: true, observer: true,
observeParents: true observeParents: true,
}, },
info: [], info: [],
activeIndex: 0 activeIndex: 0,
}; }
}, },
mounted: function () { mounted: function() {
this.getIndex(); this.getIndex()
let that = this; let that = this
// this.swiper.on("slideChange", function() { // this.swiper.on("slideChange", function() {
// that.activeIndex = that.swiper.activeIndex; // that.activeIndex = that.swiper.activeIndex;
// }); // });
@ -56,117 +54,125 @@
computed: { computed: {
swiper() { swiper() {
// return this.$refs.mySwiper.swiper; // return this.$refs.mySwiper.swiper;
} },
}, },
methods: { methods: {
getIndex: function () { getIndex: function() {
let that = this; let that = this
getSpreadImg({ getSpreadImg({
from: this.$deviceType == 'weixin' || this.$deviceType == 'weixinh5' ? 'uniappH5' : this.$deviceType from: this.$deviceType == 'weixin' || this.$deviceType == 'weixinh5' ? 'uniappH5' : this.$deviceType,
}).then( }).then(
res => { res => {
that.info = res.data; that.info = res.data
}, },
err => { err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message, title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none", icon: 'none',
duration: 2000 duration: 2000,
}); })
} }
); )
}, },
downloadIamge (imgsrc, name) { downloadIamge(imgsrc, name) {
var that = this; var that = this
this.isDown = true; this.isDown = true
var downloadUrl = imgsrc; var downloadUrl = imgsrc
if (!wx.saveImageToPhotosAlbum) { // if (!wx.saveImageToPhotosAlbum) {
uni.showModal({ // uni.showModal({
title: "提示", // title: '提示',
content: "当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。" // content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。',
}); // })
that.openDialogVisible = true; // that.openDialogVisible = true
return; // return
} // }
// 可以通过 wx.getSetting 先查询一下用户是否授权了 "scope.writePhotosAlbum" 这个 scope that.downloadFile(downloadUrl)
wx.getSetting({
success(res) {
if (!res.authSetting["scope.writePhotosAlbum"]) {
that.openDialogVisible = true;
// 接口调用询问 // 可以通过 uni.getSetting 先查询一下用户是否授权了 "scope.writePhotosAlbum" 这个 scope
wx.authorize({ // uni.getSetting({
scope: "scope.writePhotosAlbum", // success(res) {
success() { // if (!res.authSetting["scope.writePhotosAlbum"]) {
that.downloadFile(downloadUrl); // that.openDialogVisible = true;
// // 接口调用询问
// uni.authorize({
// scope: "scope.writePhotosAlbum",
// success() {
// that.downloadFile(downloadUrl);
// },
// fail() {
// // 用户拒绝了授权
// // 打开设置页面
// uni.openSetting({
// success: function (data) {},
// fail: function (data) {}
// });
// }
// });
// } else {
// that.downloadFile(downloadUrl);
// }
// },
// fail(res) {
// that.openDialogVisible = true;
// }
// });
}, },
fail() { saveImg: function() {
// 用户拒绝了授权 this.downloadIamge(this.info[this.activeIndex].wap_poster, 'poster' + this.activeIndex)
// 打开设置页面
wx.openSetting({
success: function (data) {},
fail: function (data) {}
});
}
});
} else {
that.downloadFile(downloadUrl);
}
}, },
fail(res) { downloadFile(url) {
that.openDialogVisible = true;
}
});
},
saveImg: function () {
this.downloadIamge(
this.info[this.activeIndex].wap_poster,
"poster" + this.activeIndex
);
},
downloadFile(url){
uni.downloadFile({ uni.downloadFile({
url, url,
fail: function(res) { fail: function(res) {
uni.showModal({ uni.showModal({
title: "提示", title: '提示',
content: "保存失败" content: '保存失败',
}); })
}, },
success: function(res) { success: function(res) {
uni.showModal({ uni.showModal({
title: "提示", title: '提示',
content: "保存成功" content: '保存成功',
}); })
} },
}); })
} },
} },
}; }
</script> </script>
<style lang="less"> <style lang="less">
page { page {
height: 100%; height: 100%;
} }
.distribution-posters { .distribution-posters {
height: 100%; height: 100%;
} }
.banenr { .banenr {
height: 100%; height: 100%;
} }
.banner swiper { .banner swiper {
height: 100%; height: 100%;
} }
.banner .slide-image { .banner .slide-image {
width: 100%; width: 100%;
height: auto; height: auto;
}
.distribution-posters {
.keep {
position: absolute;
bottom: 60rpx;
left: 60rpx;
right: 60rpx;
width: auto;
} }
}
</style> </style>