|
@@ -8,7 +8,7 @@
|
|
|
<view class="one">
|
|
|
<swiper class="swiper" circular :indicator-dots="true" indicator-color="#ffffff"
|
|
|
indicator-active-color="#FB1438" :autoplay="true" :interval="3000" :duration="1000">
|
|
|
- <swiper-item class="list" v-for="(item,index) in bannerList" :key="index">
|
|
|
+ <swiper-item class="list" v-for="(item,index) in info.file" :key="index">
|
|
|
<image class="image" :src="item.url" mode="aspectFit">
|
|
|
</image>
|
|
|
</swiper-item>
|
|
@@ -86,6 +86,15 @@
|
|
|
components: {},
|
|
|
data() {
|
|
|
return {
|
|
|
+ user: {},
|
|
|
+ // 商品id
|
|
|
+ id: '',
|
|
|
+ // 商品详情
|
|
|
+ info: {},
|
|
|
+ // 商店详情
|
|
|
+ shop: {},
|
|
|
+ // 数量
|
|
|
+ num: 1,
|
|
|
barList: [{
|
|
|
name: '首页',
|
|
|
route: 'pages/home/index',
|
|
@@ -112,22 +121,11 @@
|
|
|
backgroundColor: 'linear-gradient(90deg, #6A5ACD, #6A5ACD)',
|
|
|
color: '#fff',
|
|
|
}],
|
|
|
- // 商品id
|
|
|
- id: '',
|
|
|
- user: {},
|
|
|
- // 轮播图
|
|
|
- bannerList: [],
|
|
|
- // 商品详情
|
|
|
- info: {},
|
|
|
- // 商店详情
|
|
|
- shop: {},
|
|
|
// 是否显示返回顶部
|
|
|
isShow: false,
|
|
|
topItem: '',
|
|
|
// 菜单显示
|
|
|
menu: false,
|
|
|
- // 数量
|
|
|
- num: 1,
|
|
|
};
|
|
|
},
|
|
|
onLoad: async function(e) {
|
|
@@ -141,28 +139,31 @@
|
|
|
await that.search();
|
|
|
},
|
|
|
methods: {
|
|
|
- //主菜单跳转
|
|
|
- toPath(e) {
|
|
|
- if (e && e.route) uni.reLaunch({
|
|
|
- url: `/${e.route}`
|
|
|
- })
|
|
|
- },
|
|
|
- // 菜单展开
|
|
|
- toMenu() {
|
|
|
- const that = this;
|
|
|
- that.menu = !that.menu
|
|
|
- },
|
|
|
- // 计算高度
|
|
|
- handleScroll(e) {
|
|
|
+ // 监听用户是否登录
|
|
|
+ watchLogin() {
|
|
|
const that = this;
|
|
|
- let scrollTop = e.detail.scrollTop;
|
|
|
- that.isShow = scrollTop > 500;
|
|
|
- that.topItem = '';
|
|
|
+ uni.getStorage({
|
|
|
+ key: 'token',
|
|
|
+ success: function(res) {
|
|
|
+ let user = that.$jwt(res.data);
|
|
|
+ if (user) that.$set(that, `user`, user);
|
|
|
+ },
|
|
|
+ fail: function(err) {}
|
|
|
+ });
|
|
|
},
|
|
|
- // 返回顶部
|
|
|
- backTop() {
|
|
|
+ // 详情数据
|
|
|
+ async search() {
|
|
|
const that = this;
|
|
|
- that.topItem = 'top'
|
|
|
+ let arr = await that.$api(`/zrGoods/${that.id}`, `POST`, {}, `integral`)
|
|
|
+ if (arr.errcode == '0') {
|
|
|
+ if (arr.data.brief) arr.data.brief = arr.data.brief.replace(/\<img/gi,
|
|
|
+ '<img class="rich-img"');
|
|
|
+ that.$set(that, `info`, arr.data)
|
|
|
+ let shop = await that.$api(`/shop/${arr.data.shop}`, `GET`)
|
|
|
+ if (shop.errcode == '0') {
|
|
|
+ that.$set(that, `shop`, shop.data)
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
//立即兑换
|
|
|
buttonClick(e) {
|
|
@@ -209,32 +210,28 @@
|
|
|
}
|
|
|
|
|
|
},
|
|
|
- // 监听用户是否登录
|
|
|
- watchLogin() {
|
|
|
+ // 计算高度
|
|
|
+ handleScroll(e) {
|
|
|
const that = this;
|
|
|
- uni.getStorage({
|
|
|
- key: 'token',
|
|
|
- success: function(res) {
|
|
|
- let user = that.$jwt(res.data);
|
|
|
- if (user) that.$set(that, `user`, user);
|
|
|
- },
|
|
|
- fail: function(err) {}
|
|
|
- });
|
|
|
+ let scrollTop = e.detail.scrollTop;
|
|
|
+ that.isShow = scrollTop > 500;
|
|
|
+ that.topItem = '';
|
|
|
},
|
|
|
- // 详情数据
|
|
|
- async search() {
|
|
|
+ // 返回顶部
|
|
|
+ backTop() {
|
|
|
const that = this;
|
|
|
- let arr = await that.$api(`/zrGoods/${that.id}`, `POST`, {}, `integral`)
|
|
|
- if (arr.errcode == '0') {
|
|
|
- if (arr.data.brief) arr.data.brief = arr.data.brief.replace(/\<img/gi,
|
|
|
- '<img class="rich-img"');
|
|
|
- that.$set(that, `info`, arr.data)
|
|
|
- that.$set(that, `bannerList`, arr.data.file)
|
|
|
- let shop = await that.$api(`/shop/${arr.data.shop}`, `GET`)
|
|
|
- if (shop.errcode == '0') {
|
|
|
- that.$set(that, `shop`, shop.data)
|
|
|
- }
|
|
|
- }
|
|
|
+ that.topItem = 'top'
|
|
|
+ },
|
|
|
+ // 菜单展开
|
|
|
+ toMenu() {
|
|
|
+ const that = this;
|
|
|
+ that.menu = !that.menu
|
|
|
+ },
|
|
|
+ //主菜单跳转
|
|
|
+ toPath(e) {
|
|
|
+ if (e && e.route) uni.reLaunch({
|
|
|
+ url: `/${e.route}`
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|